Re: IN subselects and index / seq_scan question....

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: IN subselects and index / seq_scan question....
Дата
Msg-id 17248.1037677432@sss.pgh.pa.us
обсуждение исходный текст
Ответ на IN subselects and index / seq_scan question....  ("Marc Mitchell" <marcm@eisolution.com>)
Список pgsql-admin
"Marc Mitchell" <marcm@eisolution.com> writes:
> I am having an optimization problem with queries that include IN clauses
> and subselects.

The optimizer currently has no clue at all about dealing with
"IN (subselect)", and always converts it into the worst sort of
nested-loop plan.  I'm hoping to do something about that for 7.4, but
it's only pie-in-the-sky today.  In the meantime, the conventional
wisdom is to convert your query into an EXISTS() test instead of an IN()
test.  This is still nested-loop, but not as bad --- the clause you push
down into the EXISTS() has a shot at using an index.  I believe the
details are in the FAQ.

            regards, tom lane

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

Предыдущее
От: Graham Wilson
Дата:
Сообщение: Confused about user permissions and pg_hba.conf
Следующее
От: Chris Schneider
Дата:
Сообщение: Inquiry From Form [pgsql]