"John Lister" <john.lister...@kickstone.com> writes: > Am I right in assuming the planner thinks a sequential scan is quicker than > 10k index hits, would tweaking the costs fix this or would i be better > updating the stats for the product_id and manufacturer_id fields?
AFAICT the planner did exactly the right things here. Your first example is fetching 40 times as many rows from retailer_offer as the second one is. If the planner had stuck with the nestloop plan, it would've taken about 40x as long, and been significantly slower than the hash join. regards, tom lane -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql