From: Chris Hoover <revoohc@sermonaudio.com>
To: Sabio - PSQL <slopez_pg@ceroriesgo.co.cr>
Cc: PostgreSQL Admin <pgsql-admin@postgresql.org>
Subject: Re: Too slow
Date: Tue, 22 Mar 2005 13:49:20 -0500
Message-ID: <424068B0.8090101@sermonaudio.com> (raw)
In-Reply-To: <42402A4B.70703@ceroriesgo.co.cr>
References: <42402A4B.70703@ceroriesgo.co.cr>
Sabio - PSQL wrote:
> How can I improve speed on my queries. For example this query takes
> one day executing itself and it has not finalized !!!
> "create table tmp_partes as select * from partes where identificacion
> not in (select cedula from sujetos)"
>
> partes have 1888000 rows, an index on identificacion
> sujetos have 5500000 rows, an index on cedula
>
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>
>
>
try create table tmp_partes as select * from partes where not exists
(select cedula from sujetos where cedula = partes.identificacion);
The "not in (subselect)" is very slow in postgresql.
HTH,
chris
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: revoohc@sermonaudio.com, slopez_pg@ceroriesgo.co.cr, pgsql-admin@postgresql.org
Subject: Re: Too slow
In-Reply-To: <424068B0.8090101@sermonaudio.com>
* 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