News for hackers. Stuff that matters.
Re:Ask HN: What problem in your industry is a potential star... by thorin on Tuesday June 30, 2015 @10:38AM (#9805526)
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?

Re:Ask HN: What problem in your industry is a potential star... by knodi123 on Tuesday June 30, 2015 @02:54PM (#9807617)
Thanks 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!