Re: Too slow

Поиск
Список
Период
Сортировка
От Chris Hoover
Тема Re: Too slow
Дата
Msg-id 424068B0.8090101@sermonaudio.com
обсуждение исходный текст
Ответ на Too slow  (Sabio - PSQL <slopez_pg@ceroriesgo.co.cr>)
Ответы Re: Too slow  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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 по дате отправления:

Предыдущее
От: "Lee Wu"
Дата:
Сообщение: Re: Too slow
Следующее
От: Sabio - PSQL
Дата:
Сообщение: Re: Too slow