"Bealach-na Bo" <bealach_na_bo@xxxxxxxxxxx> writes: > I'm having great difficulties getting the performance I had hoped for > from Postgresql 8.0. The typical query below takes ~20 minutes !! You need to show us the table definition (including indexes) and the EXPLAIN ANALYZE results for the query. It seems likely that the NOT IN is the source of your problems, but it's hard to be sure without EXPLAIN results. regards, tom lane