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

Commit61aa825

Browse files
committed
Optimizer rename.
1 parent6724a50 commit61aa825

File tree

12 files changed

+59
-74
lines changed

12 files changed

+59
-74
lines changed

‎doc/src/sgml/ref/set.sgml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ SET TIME ZONE { '<REPLACEABLE CLASS="PARAMETER">timezone</REPLACEABLE>' | LOCAL
406406
</para>
407407
<para>
408408
This algorithm is on by default, which used GEQO for
409-
statements of six or more tables and indexes.
409+
statements of six or more tables.
410410
(See the chapter on GEQO in the Programmer's Guide
411411
for more information).
412412
</para>
@@ -677,7 +677,7 @@ SET TIME ZONE { '<REPLACEABLE CLASS="PARAMETER">timezone</REPLACEABLE>' | LOCAL
677677
SET DATESTYLE TO 'ISO';
678678
</programlisting>
679679
<programlisting>
680-
--Enable GEQO for queries with 4 or more tables and indexes
680+
--Enable GEQO for queries with 4 or more tables
681681
--
682682
SET GEQO ON=4;
683683
</programlisting>

‎src/backend/optimizer/geqo/geqo_eval.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*
66
* Copyright (c) 1994, Regents of the University of California
77
*
8-
* $Id: geqo_eval.c,v 1.29 1999/02/13 23:16:07 momjian Exp $
8+
* $Id: geqo_eval.c,v 1.30 1999/02/14 04:56:45 momjian Exp $
99
*
1010
*-------------------------------------------------------------------------
1111
*/
@@ -135,7 +135,7 @@ gimme_tree(Query *root, Gene *tour, int rel_count, int num_gene, RelOptInfo *out
135135
}
136136

137137
/* process new_rel->pathlist */
138-
find_all_join_paths(root,new_rels);
138+
update_rels_pathlist_for_joins(root,new_rels);
139139

140140
/* prune new_rels */
141141
/* MAU: is this necessary? */

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

Lines changed: 13 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/allpaths.c,v 1.31 1999/02/13 23:16:14 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/allpaths.c,v 1.32 1999/02/14 04:56:46 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -43,7 +43,7 @@ bool_use_geqo_ = false;
4343
int32_use_geqo_rels_=GEQO_RELS;
4444

4545

46-
staticvoidfind_rel_paths(Query*root,List*rels);
46+
staticvoidfind_base_rel_paths(Query*root,List*rels);
4747
staticList*find_join_paths(Query*root,List*outer_rels,intlevels_needed);
4848

4949
#ifdefOPTIMIZER_DEBUG
@@ -71,10 +71,7 @@ find_paths(Query *root, List *rels)
7171
if (levels_needed <=0)
7272
returnNIL;
7373

74-
/*
75-
* Find the base relation paths.
76-
*/
77-
find_rel_paths(root,rels);
74+
find_base_rel_paths(root,rels);
7875

7976
if (levels_needed <=1)
8077
{
@@ -96,7 +93,7 @@ find_paths(Query *root, List *rels)
9693
}
9794

9895
/*
99-
*find_rel_paths
96+
*find_base_rel_paths
10097
* Finds all paths available for scanning each relation entry in
10198
* 'rels'. Sequential scan and any available indices are considered
10299
* if possible(indices are not considered for lower nesting levels).
@@ -105,7 +102,7 @@ find_paths(Query *root, List *rels)
105102
* MODIFIES: rels
106103
*/
107104
staticvoid
108-
find_rel_paths(Query*root,List*rels)
105+
find_base_rel_paths(Query*root,List*rels)
109106
{
110107
List*temp;
111108

@@ -154,7 +151,7 @@ find_rel_paths(Query *root, List *rels)
154151
* finding ways to join relations(both original and derived) together.
155152
*
156153
* 'outer_rels' is the current list of relations for which join paths
157-
*are to be found, i.e.,he current list of relations that
154+
*are to be found, i.e.,the current list of relations that
158155
*have already been derived.
159156
* 'levels_needed' is the number of iterations needed
160157
*
@@ -172,20 +169,8 @@ find_join_paths(Query *root, List *outer_rels, int levels_needed)
172169
* genetic query optimizer entry point *
173170
* <utesch@aut.tu-freiberg.de> *
174171
*******************************************/
175-
{
176-
List*temp;
177-
intpaths_to_consider=0;
178-
179-
foreach(temp,outer_rels)
180-
{
181-
RelOptInfo*rel= (RelOptInfo*)lfirst(temp);
182-
paths_to_consider+=length(rel->pathlist);
183-
}
184-
185-
if ((_use_geqo_)&&paths_to_consider >=_use_geqo_rels_)
186-
/* returns _one_ RelOptInfo, so lcons it */
187-
returnlcons(geqo(root),NIL);
188-
}
172+
if ((_use_geqo_)&&length(root->base_relation_list_) >=_use_geqo_rels_)
173+
returnlcons(geqo(root),NIL);/* returns *one* Rel, so lcons it */
189174

190175
/*******************************************
191176
* rest will be deprecated in case of GEQO *
@@ -199,11 +184,11 @@ find_join_paths(Query *root, List *outer_rels, int levels_needed)
199184
* modify 'new_rels' accordingly, then eliminate redundant join
200185
* relations.
201186
*/
202-
new_rels=find_join_rels(root,outer_rels);
187+
new_rels=make_new_rels_by_joins(root,outer_rels);
203188

204-
find_all_join_paths(root,new_rels);
189+
update_rels_pathlist_for_joins(root,new_rels);
205190

206-
prune_joinrels(new_rels);
191+
merge_rels_with_same_relids(new_rels);
207192

208193
#if0
209194
/*
@@ -232,11 +217,11 @@ find_join_paths(Query *root, List *outer_rels, int levels_needed)
232217
foreach(x,new_rels)
233218
{
234219
rel= (RelOptInfo*)lfirst(x);
220+
235221
if (rel->size <=0)
236222
rel->size=compute_rel_size(rel);
237223
rel->width=compute_rel_width(rel);
238224

239-
/* #define OPTIMIZER_DEBUG */
240225
#ifdefOPTIMIZER_DEBUG
241226
printf("levels left: %d\n",levels_needed);
242227
debug_print_rel(root,rel);
@@ -259,6 +244,7 @@ find_join_paths(Query *root, List *outer_rels, int levels_needed)
259244
}
260245
else
261246
root->join_rel_list=new_rels;
247+
262248
if (!BushyPlanFlag)
263249
outer_rels=new_rels;
264250
}

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

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinpath.c,v 1.23 1999/02/13 23:16:18 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinpath.c,v 1.24 1999/02/14 04:56:46 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -42,7 +42,7 @@ static List *hash_inner_and_outer(RelOptInfo *joinrel, RelOptInfo *outerrel, Rel
4242
List*hashinfo_list);
4343

4444
/*
45-
*find_all_join_paths
45+
*update_rels_pathlist_for_joins
4646
* Creates all possible ways to process joins for each of the join
4747
* relations in the list 'joinrels.' Each unique path will be included
4848
* in the join relation's 'pathlist' field.
@@ -62,16 +62,17 @@ static List *hash_inner_and_outer(RelOptInfo *joinrel, RelOptInfo *outerrel, Rel
6262
* It does a destructive modification.
6363
*/
6464
void
65-
find_all_join_paths(Query*root,List*joinrels)
65+
update_rels_pathlist_for_joins(Query*root,List*joinrels)
6666
{
6767
List*mergeinfo_list=NIL;
6868
List*hashinfo_list=NIL;
6969
List*temp_list=NIL;
7070
List*path=NIL;
71+
List*j;
7172

72-
while (joinrels!=NIL)
73+
foreach(j,joinrels)
7374
{
74-
RelOptInfo*joinrel= (RelOptInfo*)lfirst(joinrels);
75+
RelOptInfo*joinrel= (RelOptInfo*)lfirst(j);
7576
List*innerrelids;
7677
List*outerrelids;
7778
RelOptInfo*innerrel;
@@ -174,8 +175,6 @@ find_all_join_paths(Query *root, List *joinrels)
174175
* since the base level
175176
*/
176177
}
177-
178-
joinrels=lnext(joinrels);
179178
}
180179
}
181180

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinrels.c,v 1.20 1999/02/13 23:16:18 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinrels.c,v 1.21 1999/02/14 04:56:47 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -44,7 +44,7 @@ static void set_joinrel_size(RelOptInfo *joinrel, RelOptInfo *outer_rel, RelOptI
4444
JoinInfo*jinfo);
4545

4646
/*
47-
*find_join_rels
47+
*make_new_rels_by_joins
4848
* Find all possible joins for each of the outer join relations in
4949
* 'outer_rels'. A rel node is created for each possible join relation,
5050
* and the resulting list of nodes is returned.If at all possible, only
@@ -57,7 +57,7 @@ static void set_joinrel_size(RelOptInfo *joinrel, RelOptInfo *outer_rel, RelOptI
5757
* Returns a list of rel nodes corresponding to the new join relations.
5858
*/
5959
List*
60-
find_join_rels(Query*root,List*outer_rels)
60+
make_new_rels_by_joins(Query*root,List*outer_rels)
6161
{
6262
List*joins=NIL;
6363
List*join_list=NIL;
@@ -69,6 +69,10 @@ find_join_rels(Query *root, List *outer_rels)
6969

7070
if (!(joins=find_clause_joins(root,outer_rel,outer_rel->joininfo)))
7171
{
72+
/*
73+
* Oops, we have a relation that is not joined to any other
74+
* relation. Cartesian product time.
75+
*/
7276
if (BushyPlanFlag)
7377
joins=find_clauseless_joins(outer_rel,outer_rels);
7478
else
@@ -124,7 +128,8 @@ find_clause_joins(Query *root, RelOptInfo *outer_rel, List *joininfo_list)
124128
{
125129
if (rel!=NULL)
126130
join_list=lappend(join_list,rel);
127-
rel=init_join_rel(get_base_rel(root,lfirsti(other_rels)),
131+
rel=init_join_rel(get_base_rel(root,
132+
lfirsti(other_rels)),
128133
outer_rel,
129134
joininfo);
130135
}

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/prune.c,v 1.31 1999/02/13 23:16:23 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/prune.c,v 1.32 1999/02/14 04:56:47 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -24,18 +24,18 @@
2424
#include"utils/elog.h"
2525

2626

27-
staticList*prune_joinrel(RelOptInfo*rel,List*other_rels);
27+
staticList*merge_rel_with_same_relids(RelOptInfo*rel,List*other_rels);
2828

2929
/*
30-
*prune_joinrels
30+
*merge_rels_with_same_relids
3131
* Removes any redundant relation entries from a list of rel nodes
3232
* 'rel_list'. Obviously, the first relation can't be a duplicate.
3333
*
3434
* Returns the resulting list.
3535
*
3636
*/
3737
void
38-
prune_joinrels(List*rel_list)
38+
merge_rels_with_same_relids(List*rel_list)
3939
{
4040
List*i;
4141

@@ -44,11 +44,11 @@ prune_joinrels(List *rel_list)
4444
* deleted
4545
*/
4646
foreach(i,rel_list)
47-
lnext(i)=prune_joinrel((RelOptInfo*)lfirst(i),lnext(i));
47+
lnext(i)=merge_rel_with_same_relids((RelOptInfo*)lfirst(i),lnext(i));
4848
}
4949

5050
/*
51-
*prune_joinrel
51+
*merge_rel_with_same_relids
5252
* Prunes those relations from 'other_rels' that are redundant with
5353
* 'rel'. A relation is redundant if it is built up of the same
5454
* relations as 'rel'. Paths for the redundant relation are merged into
@@ -59,7 +59,7 @@ prune_joinrels(List *rel_list)
5959
*
6060
*/
6161
staticList*
62-
prune_joinrel(RelOptInfo*rel,List*other_rels)
62+
merge_rel_with_same_relids(RelOptInfo*rel,List*other_rels)
6363
{
6464
List*i=NIL;
6565
List*result=NIL;
@@ -126,7 +126,7 @@ merge_joinrels(List *rel_list1, List *rel_list2)
126126
{
127127
RelOptInfo*rel= (RelOptInfo*)lfirst(xrel);
128128

129-
rel_list2=prune_joinrel(rel,rel_list2);
129+
rel_list2=merge_rel_with_same_relids(rel,rel_list2);
130130
}
131131
returnappend(rel_list1,rel_list2);
132132
}

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

Lines changed: 4 additions & 4 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/initsplan.c,v 1.23 1999/02/13 23:16:29 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/initsplan.c,v 1.24 1999/02/14 04:56:50 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -303,16 +303,16 @@ add_vars_to_targetlist(Query *root, List *vars, List *join_relids)
303303
*****************************************************************************/
304304

305305
/*
306-
*init_join_info
306+
*set_joininfo_mergeable_hashable
307307
* Set the MergeJoinable or HashJoinable field for every joininfo node
308-
* (within a rel node) and theMergeJoinOrder orHashJoinOp field for
308+
* (within a rel node) and themergejoinorder orhashjoinop field for
309309
* each restrictinfo node(within a joininfo node) for all relations in a
310310
* query.
311311
*
312312
* Returns nothing.
313313
*/
314314
void
315-
init_join_info(List*rel_list)
315+
set_joininfo_mergeable_hashable(List*rel_list)
316316
{
317317
List*x,
318318
*y,

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

Lines changed: 3 additions & 8 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/planmain.c,v 1.31 1999/02/13 23:16:30 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planmain.c,v 1.32 1999/02/14 04:56:50 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -157,7 +157,7 @@ query_planner(Query *root,
157157
else
158158
return (Plan*)scan;
159159
}
160-
break;
160+
break;
161161
default:
162162
return (Plan*)NULL;
163163
}
@@ -257,12 +257,7 @@ subplanner(Query *root,
257257
add_restrict_and_join_to_rels(root,qual);
258258
add_missing_vars_to_tlist(root,flat_tlist);
259259

260-
/*
261-
* Find all possible scan and join paths. Mark all the clauses and
262-
* relations that can be processed using special join methods, then do
263-
* the exhaustive path search.
264-
*/
265-
init_join_info(root->base_rel_list);
260+
set_joininfo_mergeable_hashable(root->base_rel_list);
266261

267262
final_rel_list=find_paths(root,root->base_rel_list);
268263

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp