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

Commitd3f0e87

Browse files
committed
Cost cleanup.
1 parent6b00ec3 commitd3f0e87

File tree

3 files changed

+29
-46
lines changed

3 files changed

+29
-46
lines changed

‎src/backend/optimizer/README

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ planner()
5252
if a join from the join clause adds only one relation, do the join
5353
or find_clauseless_joins()
5454
find_all_join_paths()
55-
generate paths(nested,mergesort) for joins found in find_join_rels()
55+
generate paths(nested,sortmerge) for joins found in find_join_rels()
5656
prune_joinrels()
5757
remove from the join list the relation we just added to each join
5858
prune_rel_paths()

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

Lines changed: 20 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.17 1997/12/1803:03:35 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.18 1997/12/1812:20:30 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -46,44 +46,33 @@
4646
staticList*switch_outer(List*clauses);
4747
staticScan*create_scan_node(Path*best_path,List*tlist);
4848
staticJoin*create_join_node(JoinPath*best_path,List*tlist);
49-
staticSeqScan*
50-
create_seqscan_node(Path*best_path,List*tlist,
49+
staticSeqScan*create_seqscan_node(Path*best_path,List*tlist,
5150
List*scan_clauses);
52-
staticIndexScan*
53-
create_indexscan_node(IndexPath*best_path,List*tlist,
51+
staticIndexScan*create_indexscan_node(IndexPath*best_path,List*tlist,
5452
List*scan_clauses);
55-
staticNestLoop*
56-
create_nestloop_node(JoinPath*best_path,List*tlist,
53+
staticNestLoop*create_nestloop_node(JoinPath*best_path,List*tlist,
5754
List*clauses,Plan*outer_node,List*outer_tlist,
5855
Plan*inner_node,List*inner_tlist);
59-
staticMergeJoin*
60-
create_mergejoin_node(MergePath*best_path,List*tlist,
56+
staticMergeJoin*create_mergejoin_node(MergePath*best_path,List*tlist,
6157
List*clauses,Plan*outer_node,List*outer_tlist,
6258
Plan*inner_node,List*inner_tlist);
63-
staticHashJoin*
64-
create_hashjoin_node(HashPath*best_path,List*tlist,
59+
staticHashJoin*create_hashjoin_node(HashPath*best_path,List*tlist,
6560
List*clauses,Plan*outer_node,List*outer_tlist,
6661
Plan*inner_node,List*inner_tlist);
6762
staticNode*fix_indxqual_references(Node*clause,Path*index_path);
68-
staticTemp*
69-
make_temp(List*tlist,List*keys,Oid*operators,
63+
staticTemp*make_temp(List*tlist,List*keys,Oid*operators,
7064
Plan*plan_node,inttemptype);
71-
staticIndexScan*
72-
make_indexscan(List*qptlist,List*qpqual,Indexscanrelid,
73-
List*indxid,List*indxqual);
74-
staticNestLoop*
75-
make_nestloop(List*qptlist,List*qpqual,Plan*lefttree,
65+
staticIndexScan*make_indexscan(List*qptlist,List*qpqual,Indexscanrelid,
66+
List*indxid,List*indxqual,Costcost);
67+
staticNestLoop*make_nestloop(List*qptlist,List*qpqual,Plan*lefttree,
7668
Plan*righttree);
77-
staticHashJoin*
78-
make_hashjoin(List*tlist,List*qpqual,
69+
staticHashJoin*make_hashjoin(List*tlist,List*qpqual,
7970
List*hashclauses,Plan*lefttree,Plan*righttree);
8071
staticHash*make_hash(List*tlist,Var*hashkey,Plan*lefttree);
81-
staticMergeJoin*
82-
make_mergesort(List*tlist,List*qpqual,
72+
staticMergeJoin*make_mergesort(List*tlist,List*qpqual,
8373
List*mergeclauses,Oidopcode,Oid*rightorder,
8474
Oid*leftorder,Plan*righttree,Plan*lefttree);
85-
staticMaterial*
86-
make_material(List*tlist,Oidtempid,Plan*lefttree,
75+
staticMaterial*make_material(List*tlist,Oidtempid,Plan*lefttree,
8776
intkeycount);
8877

8978
/*
@@ -415,9 +404,8 @@ create_indexscan_node(IndexPath *best_path,
415404
qpqual,
416405
lfirsti(best_path->path.parent->relids),
417406
best_path->indexid,
418-
fixed_indxqual);
419-
420-
scan_node->scan.plan.cost=best_path->path.path_cost;
407+
fixed_indxqual,
408+
best_path->path.path_cost);
421409

422410
return (scan_node);
423411
}
@@ -960,12 +948,13 @@ make_indexscan(List *qptlist,
960948
List*qpqual,
961949
Indexscanrelid,
962950
List*indxid,
963-
List*indxqual)
951+
List*indxqual,
952+
Costcost)
964953
{
965954
IndexScan*node=makeNode(IndexScan);
966955
Plan*plan=&node->scan.plan;
967956

968-
plan->cost=0.0;
957+
plan->cost=cost;
969958
plan->state= (EState*)NULL;
970959
plan->targetlist=qptlist;
971960
plan->qual=qpqual;
@@ -1117,11 +1106,11 @@ make_material(List *tlist,
11171106
}
11181107

11191108
Agg*
1120-
make_agg(List*tlist,intnagg,Aggreg**aggs)
1109+
make_agg(List*tlist,intnagg,Aggreg**aggs,Plan*lefttree)
11211110
{
11221111
Agg*node=makeNode(Agg);
11231112

1124-
node->plan.cost=0.0;
1113+
node->plan.cost=(lefttree ?lefttree->cost :0);
11251114
node->plan.state= (EState*)NULL;
11261115
node->plan.qual=NULL;
11271116
node->plan.targetlist=tlist;

‎src/include/optimizer/planmain.h

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* Copyright (c) 1994, Regents of the University of California
88
*
9-
* $Id: planmain.h,v 1.6 1997/11/26 01:13:48 momjian Exp $
9+
* $Id: planmain.h,v 1.7 1997/12/18 12:21:02 momjian Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -21,24 +21,20 @@
2121
/*
2222
* prototypes for plan/planmain.c
2323
*/
24-
externPlan*
25-
query_planner(Query*root,
24+
externPlan*query_planner(Query*root,
2625
intcommand_type,List*tlist,List*qual);
2726

2827

2928
/*
3029
* prototypes for plan/createplan.c
3130
*/
3231
externPlan*create_plan(Path*best_path);
33-
externSeqScan*
34-
make_seqscan(List*qptlist,List*qpqual,Indexscanrelid,
32+
externSeqScan*make_seqscan(List*qptlist,List*qpqual,Indexscanrelid,
3533
Plan*lefttree);
36-
externSort*
37-
make_sort(List*tlist,Oidtempid,Plan*lefttree,
34+
externSort*make_sort(List*tlist,Oidtempid,Plan*lefttree,
3835
intkeycount);
39-
externAgg*make_agg(List*tlist,intnagg,Aggreg**aggs);
40-
externGroup*
41-
make_group(List*tlist,booltuplePerGroup,intngrp,
36+
externAgg*make_agg(List*tlist,intnagg,Aggreg**aggs,Plan*lefttree);
37+
externGroup*make_group(List*tlist,booltuplePerGroup,intngrp,
4238
AttrNumber*grpColIdx,Sort*lefttree);
4339
externUnique*make_unique(List*tlist,Plan*lefttree,char*uniqueAttr);
4440
externList*generate_fjoin(List*tlist);
@@ -56,11 +52,9 @@ extern void add_missing_vars_to_base_rels(Query *root, List *tlist);
5652
* prototypes for plan/setrefs.c
5753
*/
5854
externvoidset_tlist_references(Plan*plan);
59-
externList*
60-
join_references(List*clauses,List*outer_tlist,
55+
externList*join_references(List*clauses,List*outer_tlist,
6156
List*inner_tlist);
62-
externList*
63-
index_outerjoin_references(List*inner_indxqual,
57+
externList*index_outerjoin_references(List*inner_indxqual,
6458
List*outer_tlist,Indexinner_relid);
6559
externvoidset_result_tlist_references(Result*resultNode);
6660
externvoidset_agg_tlist_references(Agg*aggNode);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp