Re: Too slow - Mailing list pgsql-admin

From Chris Hoover
Subject Re: Too slow
Date
Msg-id 424068B0.8090101@sermonaudio.com
Whole thread Raw
In response to Too slow  (Sabio - PSQL <slopez_pg@ceroriesgo.co.cr>)
Responses Re: Too slow  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-admin
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


pgsql-admin by date:

Previous
From: "Lee Wu"
Date:
Subject: Re: Too slow
Next
From: Sabio - PSQL
Date:
Subject: Re: Too slow