Re: Very slow queries w/ NOT IN preparation (seems like a bug, test case) - Mailing list pgsql-general

From Sergey Konoplev
Subject Re: Very slow queries w/ NOT IN preparation (seems like a bug, test case)
Date
Msg-id c3a7de1f0811110603x1e089e8fh55aefcfec8df32e4@mail.gmail.com
Whole thread Raw
In response to Re: Very slow queries w/ NOT IN preparation (seems like a bug, test case)  (Richard Huxton <dev@archonet.com>)
Responses Re: Very slow queries w/ NOT IN preparation (seems like a bug, test case)  (Richard Huxton <dev@archonet.com>)
List pgsql-general
> 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.

Just run the test script I attached.


--
Regards,
Sergey Konoplev
--
PostgreSQL articles in english & russian
http://gray-hemp.blogspot.com/search/label/postgresql/

pgsql-general by date:

Previous
From: Magnus Hagander
Date:
Subject: Re: db_user_namespace, md5 and changing passwords
Next
From: Tom Lane
Date:
Subject: Re: Very slow queries w/ NOT IN preparation (seems like a bug, test case)