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: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Richard Huxton" <dev(at)archonet(dot)com>, 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:12:35
Message-ID: c3a7de1f0811110612g7aa256a4xbf872081f075f6ef@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.
>
> If I'm reading it right the query returns 5000 instances of "1". So
> there's definitely scope for the client side to pose a performance
> issue.
>

Query doesn't return 5000 instances of "1".

It returns just few rows of EXPLAIN output cos I do

EXPLAIN (without ANALYZE) ... NOT IN (a lot of values)

(pay attention to NOT IN)

And it works extremly slow oposite to

EXPLAIN (without ANALYZE) ... IN (a lot of values)

which works fast.

That is the main problem.

Another thing is that even I set statement_timeout to 20s the query
with NOT IN finishes working after 30+ seconds without "canceled by
statement timeout" error.

--
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 Richard Huxton 2008-11-11 14:16:53 Re: Very slow queries w/ NOT IN preparation (seems like a bug, test case)
Previous Message Tom Lane 2008-11-11 14:12:14 Re: Very slow queries w/ NOT IN preparation (seems like a bug, test case)

Browse pgsql-hackers by date

  From Date Subject
Next Message Richard Huxton 2008-11-11 14:16:53 Re: Very slow queries w/ NOT IN preparation (seems like a bug, test case)
Previous Message Tom Lane 2008-11-11 14:12:14 Re: Very slow queries w/ NOT IN preparation (seems like a bug, test case)