Why is this sub-query select so slow?
Why is this sub-query select so slow?
От:
Kevin Sangalee <kevin@susa.net>
Дата:
I am querying across two tables, each of around 35000 records. My sql is select * from fieldcounts where prodnum in (select prodnum from products where value < 150); If I execute them individually, they return immediately. When I do an explain, the fieldcounts is always accessed sequentially. It's accessed via and Index Scan when I do... select * from fieldcounts where prodnum in (65,66,45); for example Why doesn't postgresql use an index scan when the subselect is a query? Any ideas gratefully appreciated.