Re: Too slow

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Too slow
Дата
Msg-id 11070.1111518881@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Too slow  ("Chris Hoover" <revoohc@sermonaudio.com>)
Список pgsql-admin
"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

В списке pgsql-admin по дате отправления:

Предыдущее
От: "Chris Hoover"
Дата:
Сообщение: PostgreSQL, INC. Support
Следующее
От: "ESPARZA JUAREZ EDUARDO"
Дата:
Сообщение: Re: testing pgpool