Re: improve 'where not exists' query..

Поиск
Список
Период
Сортировка
От Bruno Wolff III
Тема Re: improve 'where not exists' query..
Дата
Msg-id 20051026175458.GB11447@wolff.to
обсуждение исходный текст
Ответ на improve 'where not exists' query..  (Noel Whelan <noel.whelan@gmail.com>)
Ответы Re: improve 'where not exists' query..  (Noel Whelan <noel.whelan@gmail.com>)
Список pgsql-general
On Tue, Oct 25, 2005 at 15:46:52 -0500,
  Noel Whelan <noel.whelan@gmail.com> wrote:
> I'm wondering if there's an ideal way to improve the efficiency of this
> query:
>
> SELECT i.id <http://i.id> FROM items i
> WHERE (NOT (EXISTS (SELECT c.id <http://c.id>
> FROM contacts c WHERE (c.id <http://c.id> = i.id <http://i.id>))));
>
> It takes a while to execute, clearly. Thank you,

On recent versions of postgres, NOT IN is potentially faster.

Have you looked at EXPLAIN ANALYZE output to see if anything looks amiss?

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

Предыдущее
От: "Wes Williams"
Дата:
Сообщение: Re: Why database is corrupted after re-booting
Следующее
От: Noel Whelan
Дата:
Сообщение: Re: improve 'where not exists' query..