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

Commitbf31535

Browse files
committed
Don't Memoize lateral joins with volatile join conditions
The use of Memoize was already disabled in normal joins when the joinconditions had volatile functions per the code inmatch_opclause_to_indexcol(). Ordinarily, the parameterization for theinner side of a nested loop will be an Index Scan or at least eventuallylead to an index scan (perhaps nested several joins deep). However, forlateral joins, that's not the case and seq scans can be parameterizedtoo, so we can't rely on match_opclause_to_indexcol().Here we explicitly check the parameterization for volatile functions anddon't consider the generation of a Memoize path when such functionsare present.Author: Richard GuoDiscussion:https://postgr.es/m/CAMbWs49nHFnHbpepLsv_yF3qkpCS4BdB-v8HoJVv8_=Oat0u_w@mail.gmail.comBackpatch-through: 14, where Memoize was introduced
1 parent7c9f0c0 commitbf31535

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -595,6 +595,23 @@ get_memoize_path(PlannerInfo *root, RelOptInfo *innerrel,
595595
returnNULL;
596596
}
597597

598+
/*
599+
* Also check the parameterized path restrictinfos for volatile functions.
600+
* Indexed functions must be immutable so shouldn't have any volatile
601+
* functions, however, with a lateral join the inner scan may not be an
602+
* index scan.
603+
*/
604+
if (inner_path->param_info!=NULL)
605+
{
606+
foreach(lc,inner_path->param_info->ppi_clauses)
607+
{
608+
RestrictInfo*rinfo= (RestrictInfo*)lfirst(lc);
609+
610+
if (contain_volatile_functions((Node*)rinfo))
611+
returnNULL;
612+
}
613+
}
614+
598615
/*
599616
* When considering a partitionwise join, we have clauses that reference
600617
* the outerrel's top parent not outerrel itself.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp