Short-circuit sort_inner_and_outer if there are no mergejoin clauses

Поиск
Список
Период
Сортировка
От Richard Guo
Тема Short-circuit sort_inner_and_outer if there are no mergejoin clauses
Дата
Msg-id CAMbWs48RKiZGFEd5A0JtztRY5ZdvVvNiHh0AKeuoz21F+0dVjQ@mail.gmail.com
обсуждение исходный текст
Ответы Re: Short-circuit sort_inner_and_outer if there are no mergejoin clauses
Список pgsql-hackers
In sort_inner_and_outer, we create mergejoin join paths by explicitly
sorting both relations on each possible ordering of the available
mergejoin clauses.  However, if there are no available mergejoin
clauses, we can skip this process entirely.  It seems that this is a
relatively common scenario.  Checking the regression tests I noticed
that there are a lot of cases where we would arrive here with an empty
mergeclause_list.

So I'm wondering if it's worth considering a shortcut in
sort_inner_and_outer by checking if mergeclause_list is empty.  This can
help skip all the statements preceding select_outer_pathkeys_for_merge.
In particular this may help avoid building UniquePath paths in the case
of JOIN_UNIQUE_OUTER or JOIN_UNIQUE_INNER.

I asked this because in the "Right Semi Join" patch [1] I wanted to
exclude mergejoin from being considered for JOIN_RIGHT_SEMI.  So I set
mergeclause_list to NIL, but noticed that it still runs the statements
in sort_inner_and_outer until no available outer pathkeys are found in
select_outer_pathkeys_for_merge.

Attached is a trivial patch for this.  Thoughts?

Вложения

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

Предыдущее
От: "Anton A. Melnikov"
Дата:
Сообщение: Re: Use XLOG_CONTROL_FILE macro everywhere?
Следующее
От: Anthonin Bonnefoy
Дата:
Сообщение: Re: Fix parallel vacuum buffer usage reporting