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

Commitb5415e3

Browse files
committed
Support parameterized TidPaths.
Up to now we've not worried much about joins where the join key is arelation's CTID column, reasoning that storing a table's CTIDs in someother table would be pretty useless. However, there are use-cases forthis sort of query involving self-joins, so that argument doesn't reallyhold water.This patch allows generating plans for joins on CTID that use a nestloopwith inner TidScan, similar to what we might do with an index on the joincolumn. This is the most efficient way to join when the outer side ofthe nestloop is expected to yield relatively few rows.This change requires upgrading tidpath.c and the generated TidPathsto work with RestrictInfos instead of bare qual clauses, but that'slong-postponed technical debt anyway.Discussion:https://postgr.es/m/17443.1545435266@sss.pgh.pa.us
1 parent6f19a8c commitb5415e3

File tree

8 files changed

+415
-140
lines changed

8 files changed

+415
-140
lines changed

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1202,15 +1202,18 @@ cost_tidscan(Path *path, PlannerInfo *root,
12021202
ntuples=0;
12031203
foreach(l,tidquals)
12041204
{
1205-
if (IsA(lfirst(l),ScalarArrayOpExpr))
1205+
RestrictInfo*rinfo=lfirst_node(RestrictInfo,l);
1206+
Expr*qual=rinfo->clause;
1207+
1208+
if (IsA(qual,ScalarArrayOpExpr))
12061209
{
12071210
/* Each element of the array yields 1 tuple */
1208-
ScalarArrayOpExpr*saop= (ScalarArrayOpExpr*)lfirst(l);
1211+
ScalarArrayOpExpr*saop= (ScalarArrayOpExpr*)qual;
12091212
Node*arraynode= (Node*)lsecond(saop->args);
12101213

12111214
ntuples+=estimate_array_length(arraynode);
12121215
}
1213-
elseif (IsA(lfirst(l),CurrentOfExpr))
1216+
elseif (IsA(qual,CurrentOfExpr))
12141217
{
12151218
/* CURRENT OF yields 1 tuple */
12161219
isCurrentOf= true;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp