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

Commitf0f13a3

Browse files
committed
Fix estimates for ModifyTable paths without RETURNING.
In the past, we always estimated that a ModifyTable node would emit thesame number of rows as its subpaths. Without a RETURNING clause, thecorrect estimate is zero. Fix, in preparation for a proposed parallelwrite patch that is sensitive to that number.A remaining problem is that for RETURNING queries, the estimated widthis based on subpath output rather than the RETURNING tlist.Reviewed-by: Greg Nancarrow <gregn4422@gmail.com>Discussion:https://postgr.es/m/CAJcOf-cXnB5cnMKqWEp2E2z7Mvcd04iLVmV%3DqpFJrR3AcrTS3g%40mail.gmail.com
1 parent3fb6765 commitf0f13a3

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

‎src/backend/optimizer/util/pathnode.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3583,15 +3583,18 @@ create_modifytable_path(PlannerInfo *root, RelOptInfo *rel,
35833583
if (lc==list_head(subpaths))/* first node? */
35843584
pathnode->path.startup_cost=subpath->startup_cost;
35853585
pathnode->path.total_cost+=subpath->total_cost;
3586-
pathnode->path.rows+=subpath->rows;
3587-
total_size+=subpath->pathtarget->width*subpath->rows;
3586+
if (returningLists!=NIL)
3587+
{
3588+
pathnode->path.rows+=subpath->rows;
3589+
total_size+=subpath->pathtarget->width*subpath->rows;
3590+
}
35883591
}
35893592

35903593
/*
35913594
* Set width to the average width of the subpath outputs. XXX this is
3592-
* totally wrong: we shouldreport zero if noRETURNING, else an average
3593-
*of the RETURNING tlistwidths. But it's what happened historically,
3594-
*and improving it is a taskfor another day.
3595+
* totally wrong: we shouldreturn an average of theRETURNING tlist
3596+
* widths. But it's what happened historically, and improving it is a task
3597+
* for another day.
35953598
*/
35963599
if (pathnode->path.rows>0)
35973600
total_size /=pathnode->path.rows;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp