[COMMITTERS] pgsql: Fix mis-optimization of semijoins with more than one LHSrelatio

Поиск
Список
Период
Сортировка
От Tom Lane
Тема [COMMITTERS] pgsql: Fix mis-optimization of semijoins with more than one LHSrelatio
Дата
Msg-id E1d5GEF-0002m0-2w@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Fix mis-optimization of semijoins with more than one LHS relation.

The inner-unique patch (commit 9c7f5229a) supposed that if we're
considering a JOIN_UNIQUE_INNER join path, we can always set inner_unique
for the join, because the inner path produced by create_unique_path should
be unique relative to the outer relation.  However, that's true only if
we're considering joining to the whole outer relation --- otherwise we may
be applying only some of the join quals, and so the inner path might be
non-unique from the perspective of this join.  Adjust the test to only
believe that we can set inner_unique if we have the whole semijoin LHS on
the outer side.

There is more that can be done in this area, but this commit is only
intended to provide the minimal fix needed to get correct plans.

Per report from Teodor Sigaev.  Thanks to David Rowley for preliminary
investigation.

Discussion: https://postgr.es/m/f994fc98-389f-4a46-d1bc-c42e05cb43ed@sigaev.ru

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/2057a58d1629ebffce694e3cef7f714571a88dd7

Modified Files
--------------
src/backend/optimizer/path/joinpath.c | 10 +++++++---
src/test/regress/expected/join.out    | 29 +++++++++++++++++++++++++++++
src/test/regress/sql/join.sql         |  8 ++++++++
3 files changed, 44 insertions(+), 3 deletions(-)


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: [COMMITTERS] pgsql: Update time zone data files to tzdata release 2017b.
Следующее
От: Tom Lane
Дата:
Сообщение: [COMMITTERS] pgsql: Reduce semijoins with unique inner relations to plain innerjoin