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

From: Richard Huxton <dev(at)archonet(dot)com>
To: Sergey Konoplev <gray(dot)ru(at)gmail(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 11:03:20
Message-ID: 49196678.1080501@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Sergey Konoplev wrote:
>
> I've faced strange parser (or may be planner) behaviour. When I do
> "EXPLAIN SELECT 1 FROM table1 WHERE table1_id IN (...~2000 ids
> here...);" it works as fast as I expect (50 ms). But when I rewrite it
> using NOT IN "EXPLAIN SELECT 1 FROM table1 WHERE table1_id NOT IN
> (...~2000 ids here...);" it gets much more slower (34537 ms).

Can you post the EXPLAIN ANALYSE output from your NOT IN query?

--
Richard Huxton
Archonet Ltd

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2008-11-11 11:13:56 Re: Question about weird construct
Previous Message Joao Ferreira gmail 2008-11-11 10:49:32 merge 2 dumps

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Meskes 2008-11-11 11:44:31 Re: gram.y=>preproc.y
Previous Message Sergey Konoplev 2008-11-11 10:27:07 Very slow queries w/ NOT IN preparation (seems like a bug, test case)