Re: [SQL] Query planning question

2009-05-11 Thread John Lister
"John Lister" 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. You

Re: [SQL] Query planning question

2009-05-11 Thread Tom Lane
"John Lister" 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.

[SQL] Query planning question

2009-05-11 Thread John Lister
Doing the following query select distinct m.id, m.name from manufacturer_manufacturer m join product_product p on (p.manufacturer_id=m.id) join retailer_offer o on (o.product_id=p.id) where o.retailer_id=XXX and o.active results in one of 2 query plans depending upon the v