Re: Too slow

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Chris Hoover" <revoohc(at)sermonaudio(dot)com>
Cc: "Sabio - PSQL" <slopez_pg(at)ceroriesgo(dot)co(dot)cr>, "PostgreSQL Admin" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: Too slow
Date: 2005-03-22 19:14:41
Message-ID: 11070.1111518881@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-performance

"Chris Hoover" <revoohc(at)sermonaudio(dot)com> writes:
> The "not in (subselect)" is very slow in postgresql.

It's OK as long as the subselect result is small enough to hash, but
with 5500000 rows that's not going to happen :-(.

Another issue is that if there are any NULLs in the subselect then you
will probably not like the results. They are correct per spec but not
very intuitive.

Personally I'd try ye olde outer join trick:

select partes.*
from partes left join sujetos on (identificacion = cedula)
where cedula is null;

A merge join on this would likely be the most effective solution.

regards, tom lane

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message ESPARZA JUAREZ EDUARDO 2005-03-22 19:17:58 Re: testing pgpool
Previous Message Chris Hoover 2005-03-22 19:13:08 PostgreSQL, INC. Support

Browse pgsql-performance by date

  From Date Subject
Next Message Alex Turner 2005-03-22 19:36:46 Re: Planner issue
Previous Message Sabio - PSQL 2005-03-22 19:10:08 Re: Too slow