From: Tom Lane <tgl@sss.pgh.pa.us>
To: Chris Hoover <revoohc@sermonaudio.com>
Cc: Sabio - PSQL <slopez_pg@ceroriesgo.co.cr>
Cc: PostgreSQL Admin <pgsql-admin@postgresql.org>
Subject: Re: Too slow
Date: Tue, 22 Mar 2005 14:14:41 -0500
Message-ID: <11070.1111518881@sss.pgh.pa.us> (raw)
In-Reply-To: <424068B0.8090101@sermonaudio.com>
References: <42402A4B.70703@ceroriesgo.co.cr>
<424068B0.8090101@sermonaudio.com>
"Chris Hoover" <revoohc@sermonaudio.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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: tgl@sss.pgh.pa.us, revoohc@sermonaudio.com, slopez_pg@ceroriesgo.co.cr, pgsql-admin@postgresql.org
Subject: Re: Too slow
In-Reply-To: <11070.1111518881@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox