On Wed, Aug 15, 2018 at 3:31 PM, Adrian Klaver <adrian.klaver@xxxxxxxxxxx> wrote:
lts.date_added > '2017-07-14 11:13:05'
and
lts.date_gifted >= '2017-08-13 11:13:05'
?
In other words one '>' and the other '>=' ?
The date_added filters were added just to use that index and with a broad range, since there isn't a filter on date_gifted. You'll notice the date_added range is 30 days but the date_gifted range is 3 hours. We really only care about date_gifted but at this time there isn't an index on that field.
Even as I experiment with some query rewrites, the EXPLAIN ANALYZE always says rows=75. I'm *very* curious to see why it is using that value.