Faster not in

Поиск
Список
Период
Сортировка
От grant.johnson@twcable.com
Тема Faster not in
Дата
Msg-id 3D80C46D.4080008@aol.com
обсуждение исходный текст
Список pgsql-general
I know that the not in query is VERY slow.  The suggestion I have seen
here is to do a not exists with a sub select.  There is a faster, easier
way.  Do a left join and look for a null in the field on the table where
you want no match.

select a,b frrom c where b not in (select b from d);
select a,b from c where not exists (select b from d where c.b=d.b);
select a,b from c left join d on c.d=d.b where d.b is null;

This last one is faster, and more portable.


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

Предыдущее
От: "David D. Kilzer"
Дата:
Сообщение: [SCRIPT] pgrefchk -- checks referential integrity of foreign keys on tables
Следующее
От: "Ross J. Reedstrom"
Дата:
Сообщение: Re: [HACKERS] MySQL wins award - makes amusing statement