Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0140a11

Browse files
committed
Fix thinko in new match_join_clauses_to_index() logic.
We don't need to constrain the other side of an indexable join clause tonot be below an outer join; an example here isSELECT FROM t1 LEFT JOIN t2 ON t1.a = t2.b LEFT JOIN t3 ON t2.c = t3.d;We can consider an inner indexscan on t3.d using c = d as indexqual, eventhough t2.c is potentially nulled by a previous outer join. The comparablelogic in orindxpath.c has always worked that way, but I was being overlycautious here.
1 parent973e9fb commit0140a11

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

‎src/backend/optimizer/path/indxpath.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1702,17 +1702,17 @@ match_join_clauses_to_index(PlannerInfo *root,
17021702
* outer join rules.
17031703
*
17041704
* Instead of considering required_relids, we ignore clauses for which
1705-
*any referenced rel is in nullable_relids; that means there's an
1706-
*outerjoin below the clause and so it can't be checked at the
1707-
*relationscan level.
1705+
*the indexed rel is in nullable_relids; that means there's an outer
1706+
* join below the clause and so it can't be checked at the relation
1707+
* scan level.
17081708
*
17091709
* Note: unlike create_or_index_quals(), we can accept clauses that
17101710
* are marked !is_pushed_down (ie they are themselves outer-join
17111711
* clauses). This is OK because any path generated with these clauses
17121712
* could only be used in the inside of a nestloop join, which will be
17131713
* the nullable side.
17141714
*/
1715-
if (bms_overlap(rinfo->clause_relids,rinfo->nullable_relids))
1715+
if (bms_overlap(rel->relids,rinfo->nullable_relids))
17161716
continue;
17171717

17181718
/* Potentially usable, so see if it matches the index or is an OR */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp