3 ms·
I guess stuff like this: Hash Join (cost=78,396.37..2,150,742.13 rows=24,442,180 width=40) (actual rows= loops=) Hash Cond: (buyclicks.offer_id = offers.id) i
by thorin 11y ago
I guess stuff like this:
Hash Join (cost=78,396.37..2,150,742.13 rows=24,442,180 width=40) (actual rows= loops=)
Hash Cond: (buyclicks.offer_id = offers.id)
if you can filter down number of rows in these cases or maybe only return columns present in the index and/or add an index where required you will speed up. Watch out it doesn't affect insert/update too much though if you add an index. You have created fk indexes right?
- knodi123 11y agoThanks for the tip. I'm not so worried about insert/update, since this is a reporting database and the only inserts are done by backgrounded processes. Yes, we have fk indexes. I don't see how we can filter down the number of rows, since the purpose of the outer query is to get a count of how many buyclicks there were for each offer. But I'll see if I can create a covering index that reduces the join cost. Thanks again!