Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit ad4b27a

Browse files
committed
Optimizer cleanup.
1 parent c0d17c7 commit ad4b27a

File tree

13 files changed

+88
-84
lines changed

13 files changed

+88
-84
lines changed

src/backend/optimizer/geqo/geqo_misc.c

Lines changed: 4 additions & 4 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_misc.c,v 1.15 1999/02/12 06:43:26 momjian Exp $
8+
* $Id: geqo_misc.c,v 1.16 1999/02/12 17:24:47 momjian Exp $
99
*
1010
*-------------------------------------------------------------------------
1111
*/
@@ -158,7 +158,7 @@ void
158158
geqo_print_path(Query *root, Path *path, int indent)
159159
{
160160
char *ptype = NULL;
161-
NestPath *jp;
161+
JoinPath *jp;
162162
bool join = false;
163163
int i;
164164

@@ -194,7 +194,7 @@ geqo_print_path(Query *root, Path *path, int indent)
194194
{
195195
int size = path->parent->size;
196196

197-
jp = (NestPath *) path;
197+
jp = (JoinPath *) path;
198198
printf("%s size=%d cost=%f\n", ptype, size, path->path_cost);
199199
switch (nodeTag(path))
200200
{
@@ -203,7 +203,7 @@ geqo_print_path(Query *root, Path *path, int indent)
203203
for (i = 0; i < indent + 1; i++)
204204
printf("\t");
205205
printf(" clauses=(");
206-
geqo_print_joinclauses(root, ((NestPath *) path)->pathinfo);
206+
geqo_print_joinclauses(root, ((JoinPath *) path)->pathinfo);
207207
printf(")\n");
208208

209209
if (nodeTag(path) == T_MergePath)

src/backend/optimizer/geqo/geqo_paths.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_paths.c,v 1.18 1999/02/12 06:43:26 momjian Exp $
8+
* $Id: geqo_paths.c,v 1.19 1999/02/12 17:24:47 momjian Exp $
99
*
1010
*-------------------------------------------------------------------------
1111
*/
@@ -98,7 +98,7 @@ geqo_prune_rel(RelOptInfo *rel, List *other_rels)
9898
void
9999
geqo_set_cheapest(RelOptInfo *rel)
100100
{
101-
NestPath *cheapest = (NestPath *)set_cheapest(rel, rel->pathlist);
101+
JoinPath *cheapest = (JoinPath *)set_cheapest(rel, rel->pathlist);
102102

103103
if (IsA_JoinPath(cheapest))
104104
rel->size = compute_joinrel_size(cheapest);

src/backend/optimizer/path/allpaths.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/path/allpaths.c,v 1.29 1999/02/12 06:43:28 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/allpaths.c,v 1.30 1999/02/12 17:24:48 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -302,7 +302,7 @@ static void
302302
print_path(Query *root, Path *path, int indent)
303303
{
304304
char *ptype = NULL;
305-
NestPath *jp;
305+
JoinPath *jp;
306306
bool join = false;
307307
int i;
308308

@@ -338,7 +338,7 @@ print_path(Query *root, Path *path, int indent)
338338
{
339339
int size = path->parent->size;
340340

341-
jp = (NestPath *) path;
341+
jp = (JoinPath *) path;
342342
printf("%s size=%d cost=%f\n", ptype, size, path->path_cost);
343343
switch (nodeTag(path))
344344
{
@@ -347,7 +347,7 @@ print_path(Query *root, Path *path, int indent)
347347
for (i = 0; i < indent + 1; i++)
348348
printf("\t");
349349
printf(" clauses=(");
350-
print_joinclauses(root, ((NestPath *) path)->pathinfo);
350+
print_joinclauses(root, ((JoinPath *) path)->pathinfo);
351351
printf(")\n");
352352

353353
if (nodeTag(path) == T_MergePath)

src/backend/optimizer/path/costsize.c

Lines changed: 2 additions & 2 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/costsize.c,v 1.30 1999/02/12 06:43:28 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.31 1999/02/12 17:24:49 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -435,7 +435,7 @@ compute_attribute_width(TargetEntry *tlistentry)
435435
* Returns a fixnum.
436436
*/
437437
int
438-
compute_joinrel_size(NestPath *joinpath)
438+
compute_joinrel_size(JoinPath *joinpath)
439439
{
440440
Cost temp = 1.0;
441441
int temp1 = 0;

src/backend/optimizer/path/joinpath.c

Lines changed: 2 additions & 1 deletion
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.21 1999/02/12 06:43:30 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinpath.c,v 1.22 1999/02/12 17:24:49 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -372,6 +372,7 @@ match_unsorted_outer(RelOptInfo *joinrel,
372372
innerrel->pathlist,
373373
INNER);
374374

375+
/* Should we use the mergeinner, or sort the cheapest inner? */
375376
path_is_cheaper_than_sort = (bool) (mergeinnerpath &&
376377
(mergeinnerpath->path_cost <
377378
(cheapest_inner->path_cost +

src/backend/optimizer/path/predmig.c

Lines changed: 26 additions & 26 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/predmig.c,v 1.16 1999/02/12 06:43:31 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/predmig.c,v 1.17 1999/02/12 17:24:50 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -53,13 +53,13 @@
5353
* (not a join) iff it has
5454
* a non-NULL cinfo field */
5555

56-
static void xfunc_predmig(NestPath pathnode, Stream streamroot,
56+
static void xfunc_predmig(JoinPath pathnode, Stream streamroot,
5757
Stream laststream, bool *progressp);
5858
static bool xfunc_series_llel(Stream stream);
5959
static bool xfunc_llel_chains(Stream root, Stream bottom);
6060
static Stream xfunc_complete_stream(Stream stream);
6161
static bool xfunc_prdmig_pullup(Stream origstream, Stream pullme,
62-
NestPath joinpath);
62+
JoinPath joinpath);
6363
static void xfunc_form_groups(Stream root, Stream bottom);
6464
static void xfunc_free_stream(Stream root);
6565
static Stream xfunc_add_clauses(Stream current);
@@ -91,8 +91,8 @@ xfunc_do_predmig(Path root)
9191
do
9292
{
9393
progress = false;
94-
Assert(IsA(root, NestPath));
95-
xfunc_predmig((NestPath) root, (Stream) NULL, (Stream) NULL,
94+
Assert(IsA(root, JoinPath));
95+
xfunc_predmig((JoinPath) root, (Stream) NULL, (Stream) NULL,
9696
&progress);
9797
if (changed && progress)
9898
elog(DEBUG, "Needed to do a second round of predmig!\n");
@@ -111,7 +111,7 @@ xfunc_do_predmig(Path root)
111111
** Destructively modifies the join tree (via predicate pullup).
112112
*/
113113
static void
114-
xfunc_predmig(NestPath pathnode,/* root of the join tree */
114+
xfunc_predmig(JoinPath pathnode,/* root of the join tree */
115115
Stream streamroot,
116116
Stream laststream,/* for recursive calls -- these are the
117117
* root of the stream under construction,
@@ -161,11 +161,11 @@ xfunc_predmig(NestPath pathnode,/* root of the join tree */
161161
else
162162
{
163163
/* visit left child */
164-
xfunc_predmig((NestPath) get_outerjoinpath(pathnode),
164+
xfunc_predmig((JoinPath) get_outerjoinpath(pathnode),
165165
streamroot, newstream, progressp);
166166

167167
/* visit right child */
168-
xfunc_predmig((NestPath) get_innerjoinpath(pathnode),
168+
xfunc_predmig((JoinPath) get_innerjoinpath(pathnode),
169169
streamroot, newstream, progressp);
170170
}
171171

@@ -257,7 +257,7 @@ xfunc_llel_chains(Stream root, Stream bottom)
257257
*/
258258
Assert(xfunc_num_relids(pathstream) > xfunc_num_relids(tmpstream));
259259
progress = xfunc_prdmig_pullup(origstream, tmpstream,
260-
(NestPath) get_pathptr(pathstream));
260+
(JoinPath) get_pathptr(pathstream));
261261
}
262262
if (get_downstream(tmpstream))
263263
pathstream = (Stream) xfunc_get_downjoin((Stream) get_downstream(tmpstream));
@@ -304,14 +304,14 @@ xfunc_complete_stream(Stream stream)
304304

305305
/*
306306
** xfunc_prdmig_pullup
307-
** pullup a clause in a path above joinpath. Since the NestPath tree
307+
** pullup a clause in a path above joinpath. Since the JoinPath tree
308308
** doesn't have upward pointers, it's difficult to deal with. Thus we
309309
** require the original stream, which maintains pointers to all the path
310310
** nodes. We use the original stream to find out what joins are
311311
** above the clause.
312312
*/
313313
static bool
314-
xfunc_prdmig_pullup(Stream origstream, Stream pullme, NestPath joinpath)
314+
xfunc_prdmig_pullup(Stream origstream, Stream pullme, JoinPath joinpath)
315315
{
316316
RestrictInfo restrictinfo = get_cinfo(pullme);
317317
bool progress = false;
@@ -333,7 +333,7 @@ xfunc_prdmig_pullup(Stream origstream, Stream pullme, NestPath joinpath)
333333
/* pull up this node as far as it should go */
334334
for (upjoin = (Stream) xfunc_get_upjoin(orignode);
335335
upjoin != (Stream) NULL
336-
&& (NestPath) get_pathptr((Stream) xfunc_get_downjoin(upjoin))
336+
&& (JoinPath) get_pathptr((Stream) xfunc_get_downjoin(upjoin))
337337
!= joinpath;
338338
upjoin = (Stream) xfunc_get_upjoin(upjoin))
339339
{
@@ -342,12 +342,12 @@ xfunc_prdmig_pullup(Stream origstream, Stream pullme, NestPath joinpath)
342342
#endif
343343
/* move clause up in path */
344344
if (get_pathptr((Stream) get_downstream(upjoin))
345-
== (pathPtr) get_outerjoinpath((NestPath) get_pathptr(upjoin)))
345+
== (pathPtr) get_outerjoinpath((JoinPath) get_pathptr(upjoin)))
346346
whichchild = OUTER;
347347
else
348348
whichchild = INNER;
349349
restrictinfo = xfunc_pullup((Path) get_pathptr((Stream) get_downstream(upjoin)),
350-
(NestPath) get_pathptr(upjoin),
350+
(JoinPath) get_pathptr(upjoin),
351351
restrictinfo,
352352
whichchild,
353353
get_clausetype(orignode));
@@ -366,21 +366,21 @@ xfunc_prdmig_pullup(Stream origstream, Stream pullme, NestPath joinpath)
366366
temp = (Stream) get_downstream(temp))
367367
set_pathptr
368368
(temp, (pathPtr)
369-
get_outerjoinpath((NestPath) get_pathptr(upjoin)));
369+
get_outerjoinpath((JoinPath) get_pathptr(upjoin)));
370370
set_pathptr
371371
(temp,
372-
(pathPtr) get_outerjoinpath((NestPath) get_pathptr(upjoin)));
372+
(pathPtr) get_outerjoinpath((JoinPath) get_pathptr(upjoin)));
373373
}
374374
else
375375
{
376376
for (temp = (Stream) get_downstream(upjoin); is_clause(temp);
377377
temp = (Stream) get_downstream(temp))
378378
set_pathptr
379379
(temp, (pathPtr)
380-
get_innerjoinpath((NestPath) get_pathptr(upjoin)));
380+
get_innerjoinpath((JoinPath) get_pathptr(upjoin)));
381381
set_pathptr
382382
(temp, (pathPtr)
383-
get_innerjoinpath((NestPath) get_pathptr(upjoin)));
383+
get_innerjoinpath((JoinPath) get_pathptr(upjoin)));
384384
}
385385
progress = true;
386386
}
@@ -425,14 +425,14 @@ xfunc_form_groups(Query *queryInfo, Stream root, Stream bottom)
425425
if (!is_clause(temp))
426426
{
427427
if (get_pathptr((Stream) get_downstream(temp))
428-
== (pathPtr) get_outerjoinpath((NestPath) get_pathptr(temp)))
428+
== (pathPtr) get_outerjoinpath((JoinPath) get_pathptr(temp)))
429429
whichchild = OUTER;
430430
else
431431
whichchild = INNER;
432432
set_groupcost(temp,
433-
xfunc_join_expense((NestPath) get_pathptr(temp),
433+
xfunc_join_expense((JoinPath) get_pathptr(temp),
434434
whichchild));
435-
if (primjoin = xfunc_primary_join((NestPath) get_pathptr(temp)))
435+
if (primjoin = xfunc_primary_join((JoinPath) get_pathptr(temp)))
436436
{
437437
set_groupsel(temp,
438438
compute_clause_selec(queryInfo,
@@ -529,10 +529,10 @@ xfunc_add_clauses(Stream current)
529529
}
530530

531531
/* and add in the join clauses */
532-
if (IsA(get_pathptr(current), NestPath))
532+
if (IsA(get_pathptr(current), JoinPath))
533533
{
534-
primjoin = xfunc_primary_join((NestPath) get_pathptr(current));
535-
foreach(temp, get_pathrestrictinfo((NestPath) get_pathptr(current)))
534+
primjoin = xfunc_primary_join((JoinPath) get_pathptr(current));
535+
foreach(temp, get_pathrestrictinfo((JoinPath) get_pathptr(current)))
536536
{
537537
if (!equal(get_clause((RestrictInfo) lfirst(temp)), primjoin))
538538
topnode = xfunc_streaminsert((RestrictInfo) lfirst(temp), topnode,
@@ -615,11 +615,11 @@ xfunc_streaminsert(RestrictInfo restrictinfo,
615615
static int
616616
xfunc_num_relids(Stream node)
617617
{
618-
if (!node || !IsA(get_pathptr(node), NestPath))
618+
if (!node || !IsA(get_pathptr(node), JoinPath))
619619
return 0;
620620
else
621621
return (length
622-
(get_relids(get_parent((NestPath) get_pathptr(node)))));
622+
(get_relids(get_parent((JoinPath) get_pathptr(node)))));
623623
}
624624

625625
/*

src/backend/optimizer/path/prune.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/path/Attic/prune.c,v 1.29 1999/02/12 06:43:32 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/prune.c,v 1.30 1999/02/12 17:24:50 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -92,17 +92,17 @@ rels_set_cheapest(List *rel_list)
9292
{
9393
List *x = NIL;
9494
RelOptInfo *rel = (RelOptInfo *) NULL;
95-
NestPath *cheapest;
95+
JoinPath *cheapest;
9696

9797
foreach(x, rel_list)
9898
{
9999
rel = (RelOptInfo *) lfirst(x);
100100

101-
cheapest = (NestPath *) set_cheapest(rel, rel->pathlist);
101+
cheapest = (JoinPath *) set_cheapest(rel, rel->pathlist);
102102
if (IsA_JoinPath(cheapest))
103103
rel->size = compute_joinrel_size(cheapest);
104104
else
105-
elog(ERROR, "non NestPath called");
105+
elog(ERROR, "non JoinPath called");
106106
}
107107
}
108108

0 commit comments

Comments
 (0)