Re: Very slow queries w/ NOT IN preparation (seems like a bug, test case)

From: "Sergey Konoplev" <gray(dot)ru(at)gmail(dot)com>
To: "Richard Huxton" <dev(at)archonet(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org >> PG-General Mailing List" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Very slow queries w/ NOT IN preparation (seems like a bug, test case)
Date: 2008-11-11 14:03:44
Message-ID: c3a7de1f0811110603x1e089e8fh55aefcfec8df32e4@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

> 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/

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2008-11-11 14:12:14 Re: Very slow queries w/ NOT IN preparation (seems like a bug, test case)
Previous Message Magnus Hagander 2008-11-11 13:30:39 Re: db_user_namespace, md5 and changing passwords

Browse pgsql-hackers by date

  From Date Subject
Next Message Hiroshi Saito 2008-11-11 14:10:29 Re: [PATCHES] Solve a problem of LC_TIME of windows.
Previous Message Magnus Hagander 2008-11-11 13:59:01 Re: usermap regexp support