| От | 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 по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера