> > Can you post the EXPLAIN ANALYSE output from your NOT IN query? > Seq Scan on table1 (cost=0.00..12648.25 rows=3351 width=0) (actual time=0.054..140.596 rows=5000 loops=1) Filter: (table1_id <> ALL ('{123456789000, ... plus 1999 ids'::bigint[])) Total runtime: 142.303 ms (3 rows) But actual (real) time of running "EXPLAIN SELECT 1 FROM table1 WHERE table1_id NOT IN > (...~2000 ids here...);" is 2000 ids: 34102 ms -- Regards, Sergey Konoplev -- PostgreSQL articles in english & russian http://gray-hemp.blogspot.com/search/label/postgresql/ -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general