Re: WIP Join Removal

Поиск
Список
Период
Сортировка
От Heikki Linnakangas
Тема Re: WIP Join Removal
Дата
Msg-id 48BD1374.4030504@enterprisedb.com
обсуждение исходный текст
Ответ на Re: WIP Join Removal  (Simon Riggs <simon@2ndQuadrant.com>)
Ответы Re: WIP Join Removal  (Simon Riggs <simon@2ndQuadrant.com>)
Список pgsql-patches
Simon Riggs wrote:
> It turns out that a join like this
>
> select a.col2
> from a left outer join b on a.col1 = b.col1
> where b.col2 = 1;
>
> can be cheaper if we don't remove the join, when there is an index on
> a.col1 and b.col2, because the presence of b allows the values returned
> from b to be used for an index scan on a.

Umm, you *can't* remove that join. Because of the condition "b.col2 =
1", which implies that "b.col1 IS NOT NULL", that's actually equal to:

select a.col2
from a inner join b on a.col1 = b.col1
where b.col2 = 1;

--
   Heikki Linnakangas
   EnterpriseDB   http://www.enterprisedb.com

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

Предыдущее
От: Simon Riggs
Дата:
Сообщение: Re: WIP Join Removal
Следующее
От: Simon Riggs
Дата:
Сообщение: Re: WIP Join Removal