Re: Is select_outer_pathkeys_for_merge() too strict now we have Incremental Sorts?

Поиск
Список
Период
Сортировка
От David Rowley
Тема Re: Is select_outer_pathkeys_for_merge() too strict now we have Incremental Sorts?
Дата
Msg-id CAApHDvpZQzC3rMNFi0UdLg7QhN6UHvRu4Shfd7wsqE2HiRg1jw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Is select_outer_pathkeys_for_merge() too strict now we have Incremental Sorts?  (Richard Guo <guofenglinux@gmail.com>)
Ответы Re: Is select_outer_pathkeys_for_merge() too strict now we have Incremental Sorts?  (Richard Guo <guofenglinux@gmail.com>)
Список pgsql-hackers
On Wed, 20 Jul 2022 at 21:19, Richard Guo <guofenglinux@gmail.com> wrote:
> So the idea is if the ECs used by the mergeclauses are prefix of the
> query_pathkeys, we use this prefix as pathkeys for the mergejoin. Why
> not relax this further that if the ECs in the mergeclauses and the
> query_pathkeys have common prefix, we use that prefix as pathkeys? So
> that we can have a plan like below:

I don't think that's a clear-cut win. There is scoring code in there
to try to arrange the pathkey list in the order of
most-useful-to-upper-level-joins firsts.  If we were to do as you
describe we could end up generating worse plans when there is some
subsequent Merge Join above this one that has join conditions that the
query_pathkeys are not compatible with.

Maybe your idea could be made to work in cases where
bms_equal(joinrel->relids, root->all_baserels). In that case, we
should not be processing any further joins and don't need to consider
that as a factor for the scoring.

David



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

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: pg_auth_members.grantor is bunk
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: System catalog documentation chapter