Re: Automatic optimization of IN clauses via INNER JOIN

Поиск
Список
Период
Сортировка
От Thomas Hamilton
Тема Re: Automatic optimization of IN clauses via INNER JOIN
Дата
Msg-id 42380.53932.qm@web45816.mail.sp1.yahoo.com
обсуждение исходный текст
Ответ на Re: Automatic optimization of IN clauses via INNER JOIN  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Automatic optimization of IN clauses via INNER JOIN  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-performance
Yes, I see the one note that running Analyze can improve the performance.

But in our testing under the same optimization and conditions INNER JOIN is significantly outperforming IN.



----- Original Message ----
From: Tom Lane tgl@sss.pgh.pa.us

Thomas Hamilton <thomashamilton76@yahoo.com> writes:
> Apparently the latest version of MySQL has solved this problem:
http://www.xaprb.com/blog/2006/06/28/why-large-in-clauses-are-problematic/
> But I am running PostgreSQL v8.3 and am observing generally that SELECT ... WHERE ... IN (a, b, c, ...) is much
slowerthan SELECT ... INNER JOIN (SELECT a UNION ALL SELECT b UNION ALL SELECT c ...) 

> Why doesn't the optimizer automatically transform IN clauses to INNER JOINs in this fashion?

Did you read all the comments on that three-year-old article?

            regards, tom lane





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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Automatic optimization of IN clauses via INNER JOIN
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Automatic optimization of IN clauses via INNER JOIN