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

Commita9056cc

Browse files
committed
Request small targetlist for input to WindowAgg.
WindowAgg will potentially store large numbers of input rows intotuplestores to allow access to other rows in the frame. If the inputis coming via an explicit Sort node, then unneeded columns willalready have been discarded (since Sort requests a small tlist); butthere are idioms like COUNT(*) OVER () that result in the input notbeing sorted at all, and cases where the input is being sorted by somemeans other than a Sort; if we don't request a small tlist, thenWindowAgg's storage requirement is inflated by the unneeded columns.Backpatch back to 9.6, where the current tlist handling was added.(Prior to that, WindowAgg would always use a small tlist.)Discussion:https://postgr.es/m/87a7ator8n.fsf@news-spur.riddles.org.uk
1 parent979766c commita9056cc

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

‎src/backend/optimizer/plan/createplan.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2397,10 +2397,13 @@ create_windowagg_plan(PlannerInfo *root, WindowAggPath *best_path)
23972397
ListCell*lc;
23982398

23992399
/*
2400-
* WindowAgg can project, so no need to be terribly picky about child
2401-
* tlist, but we do need grouping columns to be available
2400+
* Choice of tlist here is motivated by the fact that WindowAgg will be
2401+
* storing the input rows of window frames in a tuplestore; it therefore
2402+
* behooves us to request a small tlist to avoid wasting space. We do of
2403+
* course need grouping columns to be available.
24022404
*/
2403-
subplan=create_plan_recurse(root,best_path->subpath,CP_LABEL_TLIST);
2405+
subplan=create_plan_recurse(root,best_path->subpath,
2406+
CP_LABEL_TLIST |CP_SMALL_TLIST);
24042407

24052408
tlist=build_path_tlist(root,&best_path->path);
24062409

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp