>> All fields involved are declared NOT NULL, but thanks for the heads up. >Afair the planner doesnt use that atm. I was referring to not having to care about the strange NULL semantics (as per your original comment), since I have no NULLs. Given that, I think the NOT EXISTS could be a good solution, even on 8.3 (we're planning to upgrade, but it's not a feasible solution to this particular problem), no? Basically, it seems like the main issue with the current plans is the per-tuple seq scans on the full materializations. Adding correlation (by rewriting NOT IN as NOT EXISTS) prevents materialization, hence getting rid of the biggest performance problem. Thanks, --- Maciek Sakrejda | System Architect | Truviso 1065 E. Hillsdale Blvd., Suite 215 Foster City, CA 94404 (650) 242-3500 Main www.truviso.com -- Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance