The most efficient way to put this?

Поиск
Список
Период
Сортировка
От Arsalan Zaidi
Тема The most efficient way to put this?
Дата
Msg-id 01bf01c1c42e$377f16a0$4301a8c0@directi.com
обсуждение исходный текст
Ответы Re: The most efficient way to put this?  (Jean-Michel POURE <jm.poure@freesurf.fr>)
Список pgsql-general
The query I'd like to run is fairly simple. Unfortunately, PG doesn't handle
IN's very well.

SELECT DISTINCT ON (aa.a) aa.a, aa.b, aa.c FROM aa WHERE aa.a NOT IN (select
zz.a from zz);

This is with two very large tables. Both zz and aa have many millions of
rows.

The best I've come up with so far is...

 SELECT DISTINCT ON (aa.a) aa.a, aa.b, aa.c FROM aa WHERE NOT EXISTS (SELECT
zz.a FROM zz WHERE aa.a = zz.a);

Does anyone have anything better?

--Arsalan

-------------------------------------------------------------------
People often hate those things which they do not know, or cannot understand.
--Ali Ibn Abi Talib (A.S.)


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

Предыдущее
От: Ulrich Wisser
Дата:
Сообщение: vacuum statistics
Следующее
От: "Marc Polatschek"
Дата:
Сообщение: Re: The most efficient way to put this?