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

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

pgsql-general by date:

Previous
From: "Andrus"
Date:
Subject: Re: Current log files when rotating?
Next
From: Richard Huxton
Date:
Subject: Re: LIKE, "=" and fixed-width character fields