Allow usage of match_orclause_to_indexcol() for joins
Alexander Korotkov <akorotkov@postgresql.org>
Allow usage of match_orclause_to_indexcol() for joins
This commit allows transformation of OR-clauses into SAOP's for index scans
within nested loop joins. That required the following changes.
1. Make match_orclause_to_indexcol() and group_similar_or_args() understand
const-ness in the same way as match_opclause_to_indexcol(). This
generally makes our approach more uniform.
2. Make match_join_clauses_to_index() pass OR-clauses to
match_clause_to_index().
3. Also switch match_join_clauses_to_index() to use list_append_unique_ptr()
for adding clauses to *joinorclauses. That avoids possible duplicates
when processing the same clauses with different indexes. Previously such
duplicates were elimited in match_clause_to_index(), but now
group_similar_or_args() each time generates distinct copies of grouped
OR clauses.
Discussion: https://postgr.es/m/CAPpHfdv%2BjtNwofg-p5z86jLYZUTt6tR17Wy00ta0dL%3DwHQN3ZA%40mail.gmail.com
Reviewed-by: Andrei Lepikhov <lepihov@gmail.com>
Reviewed-by: Alena Rybakina <a.rybakina@postgrespro.ru>
Reviewed-by: Pavel Borisov <pashkin.elfe@gmail.com>
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/optimizer/path/indxpath.c | modified | +41 −29 |
| src/test/regress/expected/create_index.out | modified | +32 −0 |
| src/test/regress/expected/join.out | modified | +45 −6 |
| src/test/regress/expected/partition_join.out | modified | +6 −6 |
| src/test/regress/sql/create_index.sql | modified | +9 −0 |
| src/test/regress/sql/join.sql | modified | +17 −1 |
Discussion
- POC, WIP: OR-clause support for indexes 322 messages · 2015-12-26 → 2025-03-28