Sergey Konoplev wrote: >> I've never heard of EXPLAIN ANALYSE being *faster* than the actual >> query, it's usually slower due to all the timing calls. The only thing >> it doesn't do is actually send the results over the connection to the >> client. In your case, you're not actually selecting any columns, so that >> can't be it. >> >> Are you sure there's nothing subtly different about the slow query when >> compared with the explain analyse? >> > > Sorry, but it seems like you didn't understand the problem. > > The thing is that > > EXPLAIN (without ANALYZE) ... NOT IN (a lot of values) > > works very slow but > > EXPLAIN (without ANALYZE) ... IN (a lot of values) > > works fast. It's the EXPLAIN that you're finding slow? Hold on... not seeing it here. ------------------------------------------ Testing EXPLAIN w/ NOT IN... ------------------------------------------ 100 ids: 95 ms 200 ids: 15 ms 300 ids: 17 ms 400 ids: 19 ms 500 ids: 20 ms 600 ids: 21 ms 700 ids: 23 ms 800 ids: 27 ms 900 ids: 26 ms 1000 ids: 27 ms 1100 ids: 29 ms 1200 ids: 30 ms 1300 ids: 33 ms 1400 ids: 45 ms 1500 ids: 35 ms 1600 ids: 37 ms 1700 ids: 39 ms 1800 ids: 40 ms 1900 ids: 42 ms 2000 ids: 44 ms ------------------------------------------ Testing EXPLAIN w/ IN... ------------------------------------------ 100 ids: 15 ms 200 ids: 16 ms 300 ids: 17 ms 400 ids: 20 ms 500 ids: 21 ms 600 ids: 23 ms 700 ids: 25 ms 800 ids: 27 ms 900 ids: 28 ms 1000 ids: 33 ms 1100 ids: 32 ms 1200 ids: 34 ms 1300 ids: 35 ms 1400 ids: 38 ms 1500 ids: 39 ms 1600 ids: 41 ms 1700 ids: 43 ms 1800 ids: 48 ms 1900 ids: 47 ms 2000 ids: 48 ms -- Richard Huxton Archonet Ltd -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general