I need an ANTI-JOIN (not exists SELECT something from table…/ left join table WHERE table.id IS NULL) on the same table. Acutally I have an index to serve the not exists question, but the query planner chooses to use a bitmap heap scan.
The table has 100 Million rows, so doing a heap scan is messed up…
It would be really fast if Postgres could compare to the indicies. Does Postgres have to visit the table for this ANTI-JOIN?
I know the table has to be visited at some point to serve the MVCC, but why so early? Can NOT EXISTS only be fixed by the table, because it could miss something otherwise?
You’ll need to provide version details, and as jmz says EXPLAIN ANALYSE output to get any useful advice.
Franz – don’t think whether it’s possible, test and know.
This is v9.0:
What you see will depend on your version, and the stats the planner sees.