true, but as soon as I drop indices on both tables:
root=# explain analyze select a.a from a where a not in (select a from
b); QUERY PLAN
-----------------------------------------------------------------------------------------------------------------------
Seq Scan on a (cost=88677.00..187207.00 rows=3000000 width=4)
(actual time=22803.470..26473.039 rows=600000 loops=1) Filter: (NOT (hashed subplan)) SubPlan -> Seq Scan on b
(cost=0.00..75177.00rows=5400000 width=4)
(actual time=9.232..15828.904 rows=5400000 loops=1)
Total runtime: 29357.267 ms
(5 rows)
root=# select version(); version
--------------------------------------------------------------------------------------------------------
PostgreSQL 8.3.5 on i686-redhat-linux-gnu, compiled by GCC gcc (GCC)
3.4.6 20060404 (Red Hat 3.4.6-10)
(1 row)
I thought planner should be able to choose plan that costs less.