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

Commit953208a

Browse files
committed
In a nestloop inner indexscan, it's OK to use pushed-down baserestrictinfo
clauses even if it's an outer join. This is a corner case since suchclauses could only arise from weird OUTER JOIN ON conditions, but worthfixing. Per example from Ron at cheapcomplexdevices.com.
1 parent974c5a8 commit953208a

File tree

1 file changed

+12
-22
lines changed

1 file changed

+12
-22
lines changed

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

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $PostgreSQL: pgsql/src/backend/optimizer/path/indxpath.c,v 1.195 2005/11/30 17:10:19 tgl Exp $
12+
* $PostgreSQL: pgsql/src/backend/optimizer/path/indxpath.c,v 1.196 2005/12/06 16:50:36 tgl Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -1357,50 +1357,40 @@ find_clauses_for_join(PlannerInfo *root, RelOptInfo *rel,
13571357
Relidsouter_relids,boolisouterjoin)
13581358
{
13591359
List*clause_list=NIL;
1360-
booljfound= false;
13611360
Relidsjoin_relids;
13621361
ListCell*l;
13631362

1364-
/*
1365-
* We can always use plain restriction clauses for the rel. We scan these
1366-
* first because we want them first in the clause list for the convenience
1367-
* of remove_redundant_join_clauses, which can never remove non-join
1368-
* clauses and hence won't be able to get rid of a non-join clause if it
1369-
* appears after a join clause it is redundant with.
1370-
*/
1371-
foreach(l,rel->baserestrictinfo)
1372-
{
1373-
RestrictInfo*rinfo= (RestrictInfo*)lfirst(l);
1374-
1375-
/* Can't use pushed-down clauses in outer join */
1376-
if (isouterjoin&&rinfo->is_pushed_down)
1377-
continue;
1378-
clause_list=lappend(clause_list,rinfo);
1379-
}
1380-
13811363
/* Look for joinclauses that are usable with given outer_relids */
13821364
join_relids=bms_union(rel->relids,outer_relids);
13831365

13841366
foreach(l,rel->joininfo)
13851367
{
13861368
RestrictInfo*rinfo= (RestrictInfo*)lfirst(l);
13871369

1388-
/* Can't use pushed-down clauses in outer join */
1370+
/* Can't use pushed-downjoinclauses in outer join */
13891371
if (isouterjoin&&rinfo->is_pushed_down)
13901372
continue;
13911373
if (!bms_is_subset(rinfo->required_relids,join_relids))
13921374
continue;
13931375

13941376
clause_list=lappend(clause_list,rinfo);
1395-
jfound= true;
13961377
}
13971378

13981379
bms_free(join_relids);
13991380

14001381
/* if no join clause was matched then forget it, per comments above */
1401-
if (!jfound)
1382+
if (clause_list==NIL)
14021383
returnNIL;
14031384

1385+
/*
1386+
* We can also use any plain restriction clauses for the rel. We put
1387+
* these at the front of the clause list for the convenience of
1388+
* remove_redundant_join_clauses, which can never remove non-join clauses
1389+
* and hence won't be able to get rid of a non-join clause if it appears
1390+
* after a join clause it is redundant with.
1391+
*/
1392+
clause_list=list_concat(list_copy(rel->baserestrictinfo),clause_list);
1393+
14041394
/*
14051395
* We may now have clauses that are known redundant. Get rid of 'em.
14061396
*/

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp