Re: prerequisites of pull_up_sublinks

Поиск
Список
Период
Сортировка
От David Rowley
Тема Re: prerequisites of pull_up_sublinks
Дата
Msg-id CAApHDvrra1eW74aMTC=dfK6cNC9aWiwYsDp4WFPVoSdRarkSxA@mail.gmail.com
обсуждение исходный текст
Ответ на prerequisites of pull_up_sublinks  (Andy Fan <zhihui.fan1213@gmail.com>)
Ответы Re: prerequisites of pull_up_sublinks
Список pgsql-hackers
On Wed, 21 Apr 2021 at 14:55, Andy Fan <zhihui.fan1213@gmail.com> wrote:
>  * However, this optimization *only*
>  * works at the top level of WHERE or a JOIN/ON clause, because we cannot
>  * distinguish whether the ANY ought to return FALSE or NULL in cases
>  * involving NULL inputs. Also, in an outer join's ON clause we can only
>  * do this if the sublink is degenerate (ie, references only the nullable
>  * side of the join).
>
> I tried to write some SQLs but still can't understand the above comments. Any
> help here?

The code there is trying to convert sub links into joins.

For example:

explain select * from pg_Class where oid in (select attrelid from pg_attribute);

can be implemented as a join rather than a subplan or hashed subplan.
You should either see a Semi Join there or a regular join with the
pg_attribute side uniquified.

Check the plan when you change the above into NOT IN.  We don't
currently pull those up to become joins due to the fact that the null
behaviour for NOT IN is not compatible with anti-joins.

David



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

Предыдущее
От: SATYANARAYANA NARLAPURAM
Дата:
Сообщение: Re: Synchronous commit behavior during network outage
Следующее
От: Stefan Keller
Дата:
Сообщение: Re: ML-based indexing ("The Case for Learned Index Structures", a paper from Google)