[Keystone Slip # 19] NOT IN clause performs badly - Mailing list pgsql-bugs

From webmaster@postgresql.org
Subject [Keystone Slip # 19] NOT IN clause performs badly
Date
Msg-id 199907261647.MAA11811@hub.org
Whole thread Raw
List pgsql-bugs
---------------------------------------------------------------------------
Slip number -----: 19
Problem ---------: NOT IN clause performs badly
Opened by -------: Christian.Rudow@thinx.ch on 07/26/99 05:28
Assigned To -----: momjian
---------------------------------------------------------------------------
Summary:
table a (id integer
         any number/type of other attributes)
unique index on id.
holding 10'000 rows

table b (id integer)
holding a subset of 8'000 rows, that
exist in table a.

trying to select all id values from table a
that do nor exist in table b :

   select id from a
   where id not in (select id from b);

this takes hours to process, while a simple join

   select id from a,b
   where a.id = b.id

returns within seconds

explain says : sequential scan on a and b.
still 120 minutes for processing can't be.

system used :
PG 6.4 on SusE 6.0, PII/300mhz.

---------------------------------------------------------------------------
History:
07/26/99 12:47 by scrappy:
Public setting changed to 1 from 0

---------------------------------------------------------------------------


          Full information on this slip is available at:
http://www.postgresql.org/bugs/visitor.php3?sid=19&v_func=zoom

---------------------------------------------------------------------------
This message was generated automatically by Keystone at http://www.postgresql.org


pgsql-bugs by date:

Previous
From: webmaster@postgresql.org
Date:
Subject: [Keystone Slip # 19] NOT IN clause performs badly
Next
From: webmaster@postgresql.org
Date:
Subject: [Keystone Slip # 18] DROP USER causes core dump if user created a database