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

Commit8cbeb5f

Browse files
committed
Save a few cycles in simple cases: no need to call cost_sort() when there
is no presorted path to compare with.
1 parentc07118b commit8cbeb5f

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*
1515
*
1616
* IDENTIFICATION
17-
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planmain.c,v 1.53 2000/03/21 05:11:58 tgl Exp $
17+
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planmain.c,v 1.54 2000/03/24 21:40:43 tgl Exp $
1818
*
1919
*-------------------------------------------------------------------------
2020
*/
@@ -174,7 +174,6 @@ subplanner(Query *root,
174174
{
175175
RelOptInfo*final_rel;
176176
Path*cheapestpath;
177-
Pathsort_path;/* dummy for result of cost_sort */
178177
Path*presortedpath;
179178

180179
/*
@@ -288,21 +287,22 @@ subplanner(Query *root,
288287
* cheaper than doing an explicit sort on the cheapest-total-cost path.
289288
*/
290289
cheapestpath=final_rel->cheapest_total_path;
291-
cost_sort(&sort_path,root->query_pathkeys,
292-
final_rel->rows,final_rel->width);
293-
sort_path.startup_cost+=cheapestpath->total_cost;
294-
sort_path.total_cost+=cheapestpath->total_cost;
295-
296290
presortedpath=
297291
get_cheapest_fractional_path_for_pathkeys(final_rel->pathlist,
298292
root->query_pathkeys,
299293
tuple_fraction);
300294
if (presortedpath)
301295
{
296+
Pathsort_path;/* dummy for result of cost_sort */
297+
298+
cost_sort(&sort_path,root->query_pathkeys,
299+
final_rel->rows,final_rel->width);
300+
sort_path.startup_cost+=cheapestpath->total_cost;
301+
sort_path.total_cost+=cheapestpath->total_cost;
302302
if (compare_fractional_path_costs(presortedpath,&sort_path,
303303
tuple_fraction) <=0)
304304
{
305-
/*Found a better presorted path, use it */
305+
/*Presorted path is cheaper, use it */
306306
root->query_pathkeys=presortedpath->pathkeys;
307307
returncreate_plan(root,presortedpath);
308308
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp