Skip to content

Commit 54e5d25

Browse files
committed
Optimizer cleanup.
1 parent 07c33ba commit 54e5d25

File tree

15 files changed

+88
-80
lines changed

15 files changed

+88
-80
lines changed

src/backend/nodes/copyfuncs.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/nodes/copyfuncs.c,v 1.62 1999/02/05 19:59:25 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.63 1999/02/08 04:29:03 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -1093,25 +1093,25 @@ CopyPathFields(Path *from, Path *newnode)
10931093

10941094
newnode->path_cost = from->path_cost;
10951095

1096-
newnode->p_ordering.ordtype = from->p_ordering.ordtype;
1097-
if (from->p_ordering.ordtype == SORTOP_ORDER)
1096+
newnode->path_order.ordtype = from->path_order.ordtype;
1097+
if (from->path_order.ordtype == SORTOP_ORDER)
10981098
{
10991099
int len,
11001100
i;
1101-
Oid *ordering = from->p_ordering.ord.sortop;
1101+
Oid *ordering = from->path_order.ord.sortop;
11021102

11031103
if (ordering)
11041104
{
11051105
for (len = 0; ordering[len] != 0; len++)
11061106
;
1107-
newnode->p_ordering.ord.sortop = (Oid *) palloc(sizeof(Oid) * (len + 1));
1107+
newnode->path_order.ord.sortop = (Oid *) palloc(sizeof(Oid) * (len + 1));
11081108
for (i = 0; i < len; i++)
1109-
newnode->p_ordering.ord.sortop[i] = ordering[i];
1110-
newnode->p_ordering.ord.sortop[len] = 0;
1109+
newnode->path_order.ord.sortop[i] = ordering[i];
1110+
newnode->path_order.ord.sortop[len] = 0;
11111111
}
11121112
}
11131113
else
1114-
Node_Copy(from, newnode, p_ordering.ord.merge);
1114+
Node_Copy(from, newnode, path_order.ord.merge);
11151115

11161116
Node_Copy(from, newnode, keys);
11171117

src/backend/nodes/equalfuncs.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.25 1999/02/07 00:52:12 tgl Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.26 1999/02/08 04:29:04 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -337,33 +337,33 @@ _equalPath(Path *a, Path *b)
337337
/*
338338
* if (a->path_cost != b->path_cost) return(false);
339339
*/
340-
if (a->p_ordering.ordtype == SORTOP_ORDER)
340+
if (a->path_order.ordtype == SORTOP_ORDER)
341341
{
342342
int i = 0;
343343

344-
if (a->p_ordering.ord.sortop == NULL ||
345-
b->p_ordering.ord.sortop == NULL)
344+
if (a->path_order.ord.sortop == NULL ||
345+
b->path_order.ord.sortop == NULL)
346346
{
347-
if (a->p_ordering.ord.sortop != b->p_ordering.ord.sortop)
347+
if (a->path_order.ord.sortop != b->path_order.ord.sortop)
348348
return false;
349349
}
350350
else
351351
{
352-
while (a->p_ordering.ord.sortop[i] != 0 &&
353-
b->p_ordering.ord.sortop[i] != 0)
352+
while (a->path_order.ord.sortop[i] != 0 &&
353+
b->path_order.ord.sortop[i] != 0)
354354
{
355-
if (a->p_ordering.ord.sortop[i] != b->p_ordering.ord.sortop[i])
355+
if (a->path_order.ord.sortop[i] != b->path_order.ord.sortop[i])
356356
return false;
357357
i++;
358358
}
359-
if (a->p_ordering.ord.sortop[i] != 0 ||
360-
b->p_ordering.ord.sortop[i] != 0)
359+
if (a->path_order.ord.sortop[i] != 0 ||
360+
b->path_order.ord.sortop[i] != 0)
361361
return false;
362362
}
363363
}
364364
else
365365
{
366-
if (!equal(a->p_ordering.ord.merge, b->p_ordering.ord.merge))
366+
if (!equal(a->path_order.ord.merge, b->path_order.ord.merge))
367367
return false;
368368
}
369369
if (!equal(a->keys, b->keys))

src/backend/nodes/freefuncs.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/nodes/Attic/freefuncs.c,v 1.1 1999/02/06 16:50:25 wieck Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/nodes/Attic/freefuncs.c,v 1.2 1999/02/08 04:29:04 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -756,13 +756,13 @@ _freeRelOptInfo(RelOptInfo * node)
756756
static void
757757
FreePathFields(Path *node)
758758
{
759-
if (node->p_ordering.ordtype == SORTOP_ORDER)
759+
if (node->path_order.ordtype == SORTOP_ORDER)
760760
{
761-
if (node->p_ordering.ord.sortop)
762-
pfree(node->p_ordering.ord.sortop);
761+
if (node->path_order.ord.sortop)
762+
pfree(node->path_order.ord.sortop);
763763
}
764764
else
765-
freeObject(node->p_ordering.ord.merge);
765+
freeObject(node->path_order.ord.merge);
766766

767767
freeObject(node->keys);
768768

src/backend/nodes/readfuncs.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.49 1999/02/05 19:59:25 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.50 1999/02/08 04:29:04 momjian Exp $
1111
*
1212
* NOTES
1313
* Most of the read functions for plan nodes are tested. (In fact, they
@@ -1474,8 +1474,8 @@ _readPath()
14741474
local_node->path_cost = (Cost) atof(token);
14751475

14761476
#if 0
1477-
token = lsptok(NULL, &length); /* get :p_ordering */
1478-
local_node->p_ordering = nodeRead(true); /* now read it */
1477+
token = lsptok(NULL, &length); /* get :path_order */
1478+
local_node->path_order = nodeRead(true); /* now read it */
14791479
#endif
14801480

14811481
token = lsptok(NULL, &length); /* get :keys */
@@ -1508,8 +1508,8 @@ _readIndexPath()
15081508
local_node->path.path_cost = (Cost) atof(token);
15091509

15101510
#if 0
1511-
token = lsptok(NULL, &length); /* get :p_ordering */
1512-
local_node->path.p_ordering = nodeRead(true); /* now read it */
1511+
token = lsptok(NULL, &length); /* get :path_order */
1512+
local_node->path.path_order = nodeRead(true); /* now read it */
15131513
#endif
15141514

15151515
token = lsptok(NULL, &length); /* get :keys */
@@ -1549,8 +1549,8 @@ _readJoinPath()
15491549
local_node->path.path_cost = (Cost) atof(token);
15501550

15511551
#if 0
1552-
token = lsptok(NULL, &length); /* get :p_ordering */
1553-
local_node->path.p_ordering = nodeRead(true); /* now read it */
1552+
token = lsptok(NULL, &length); /* get :path_order */
1553+
local_node->path.path_order = nodeRead(true); /* now read it */
15541554
#endif
15551555

15561556
token = lsptok(NULL, &length); /* get :keys */
@@ -1616,8 +1616,8 @@ _readMergePath()
16161616
local_node->jpath.path.path_cost = (Cost) atof(token);
16171617

16181618
#if 0
1619-
token = lsptok(NULL, &length); /* get :p_ordering */
1620-
local_node->jpath.path.p_ordering = nodeRead(true); /* now read it */
1619+
token = lsptok(NULL, &length); /* get :path_order */
1620+
local_node->jpath.path.path_order = nodeRead(true); /* now read it */
16211621
#endif
16221622

16231623
token = lsptok(NULL, &length); /* get :keys */
@@ -1692,8 +1692,8 @@ _readHashPath()
16921692
local_node->jpath.path.path_cost = (Cost) atof(token);
16931693

16941694
#if 0
1695-
token = lsptok(NULL, &length); /* get :p_ordering */
1696-
local_node->jpath.path.p_ordering = nodeRead(true); /* now read it */
1695+
token = lsptok(NULL, &length); /* get :path_order */
1696+
local_node->jpath.path.path_order = nodeRead(true); /* now read it */
16971697
#endif
16981698

16991699
token = lsptok(NULL, &length); /* get :keys */

src/backend/optimizer/README

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
The optimizer generates optimial query plans by doing several steps:
2+
3+
Take each relation in a query, and make a RelOptInfo structure for it.
4+
Find each way of accessing the relation, called a Path, including
5+
sequential and index scans, and add it to the RelOptInfo.path_order
6+
list.
7+
8+
19
Optimizer Functions
210
-------------------
311

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.12 1998/09/01 04:29:21 momjian Exp $
8+
* $Id: geqo_paths.c,v 1.13 1999/02/08 04:29:06 momjian Exp $
99
*
1010
*-------------------------------------------------------------------------
1111
*/
@@ -113,7 +113,7 @@ geqo_rel_paths(RelOptInfo * rel)
113113
{
114114
path = (Path *) lfirst(y);
115115

116-
if (!path->p_ordering.ord.sortop)
116+
if (!path->path_order.ord.sortop)
117117
break;
118118
}
119119

src/backend/optimizer/path/indxpath.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.38 1999/02/05 19:59:26 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.39 1999/02/08 04:29:08 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -1290,8 +1290,8 @@ index_innerjoin(Query *root, RelOptInfo * rel, List *clausegroup_list,
12901290

12911291
pathnode->path.pathtype = T_IndexScan;
12921292
pathnode->path.parent = rel;
1293-
pathnode->path.p_ordering.ordtype = SORTOP_ORDER;
1294-
pathnode->path.p_ordering.ord.sortop = index->ordering;
1293+
pathnode->path.path_order.ordtype = SORTOP_ORDER;
1294+
pathnode->path.path_order.ord.sortop = index->ordering;
12951295
pathnode->path.keys = NIL; /* not sure about this, bjm 1998/09/21 */
12961296

12971297
pathnode->indexid = index->relids;

src/backend/optimizer/path/joinpath.c

Lines changed: 3 additions & 3 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.14 1999/02/04 03:19:08 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinpath.c,v 1.15 1999/02/08 04:29:11 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -328,7 +328,7 @@ match_unsorted_outer(RelOptInfo * joinrel,
328328

329329
outerpath = (Path *) lfirst(i);
330330

331-
outerpath_ordering = &outerpath->p_ordering;
331+
outerpath_ordering = &outerpath->path_order;
332332

333333
if (outerpath_ordering)
334334
{
@@ -471,7 +471,7 @@ match_unsorted_inner(RelOptInfo * joinrel,
471471

472472
innerpath = (Path *) lfirst(i);
473473

474-
innerpath_ordering = &innerpath->p_ordering;
474+
innerpath_ordering = &innerpath->path_order;
475475

476476
if (innerpath_ordering)
477477
{

src/backend/optimizer/path/joinutils.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/Attic/joinutils.c,v 1.10 1999/02/06 17:29:26 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/joinutils.c,v 1.11 1999/02/08 04:29:12 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -219,7 +219,7 @@ match_paths_joinkeys(List *joinkeys,
219219
key_match = every_func(joinkeys, path->keys, which_subkey);
220220

221221
if (equal_path_ordering(ordering,
222-
&path->p_ordering) &&
222+
&path->path_order) &&
223223
length(joinkeys) == length(path->keys) &&
224224
key_match)
225225
{

src/backend/optimizer/path/mergeutils.c

Lines changed: 5 additions & 5 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/mergeutils.c,v 1.13 1999/02/06 17:29:26 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/mergeutils.c,v 1.14 1999/02/08 04:29:12 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -52,16 +52,16 @@ group_clauses_by_order(List *restrictinfo_list,
5252
* Create a new mergeinfo node and add it to 'mergeinfo-list'
5353
* if one does not yet exist for this merge ordering.
5454
*/
55-
PathOrder p_ordering;
55+
PathOrder path_order;
5656
MergeInfo *xmergeinfo;
5757
Expr *clause = restrictinfo->clause;
5858
Var *leftop = get_leftop(clause);
5959
Var *rightop = get_rightop(clause);
6060
JoinKey *keys;
6161

62-
p_ordering.ordtype = MERGE_ORDER;
63-
p_ordering.ord.merge = merge_ordering;
64-
xmergeinfo = match_order_mergeinfo(&p_ordering, mergeinfo_list);
62+
path_order.ordtype = MERGE_ORDER;
63+
path_order.ord.merge = merge_ordering;
64+
xmergeinfo = match_order_mergeinfo(&path_order, mergeinfo_list);
6565
if (inner_relid == leftop->varno)
6666
{
6767
keys = makeNode(JoinKey);

src/backend/optimizer/path/orindxpath.c

Lines changed: 3 additions & 3 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/orindxpath.c,v 1.14 1999/02/03 21:16:28 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/orindxpath.c,v 1.15 1999/02/08 04:29:12 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -104,13 +104,13 @@ create_or_index_paths(Query *root,
104104

105105
pathnode->path.pathtype = T_IndexScan;
106106
pathnode->path.parent = rel;
107-
pathnode->path.p_ordering.ordtype = SORTOP_ORDER;
107+
pathnode->path.path_order.ordtype = SORTOP_ORDER;
108108
/*
109109
* This is an IndexScan, but it does index lookups based
110110
* on the order of the fields specified in the WHERE clause,
111111
* not in any order, so the sortop is NULL.
112112
*/
113-
pathnode->path.p_ordering.ord.sortop = NULL;
113+
pathnode->path.path_order.ord.sortop = NULL;
114114
pathnode->path.keys = NIL; /* not sure about this, bjm 1998/09/21 */
115115

116116
pathnode->indexqual = lcons(clausenode, NIL);

src/backend/optimizer/path/prune.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/Attic/prune.c,v 1.23 1999/02/05 20:34:11 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/prune.c,v 1.24 1999/02/08 04:29:12 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -109,7 +109,7 @@ prune_rel_paths(List *rel_list)
109109
{
110110
path = (Path *) lfirst(y);
111111

112-
if (!path->p_ordering.ord.sortop)
112+
if (!path->path_order.ord.sortop)
113113
break;
114114
}
115115
cheapest = (JoinPath *) prune_rel_path(rel, path);

src/backend/optimizer/plan/createplan.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/createplan.c,v 1.37 1999/02/05 19:59:27 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.38 1999/02/08 04:29:17 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -529,14 +529,14 @@ create_mergejoin_node(MergePath *best_path,
529529
outer_tlist,
530530
inner_tlist));
531531

532-
opcode = get_opcode((best_path->jpath.path.p_ordering.ord.merge)->join_operator);
532+
opcode = get_opcode((best_path->jpath.path.path_order.ord.merge)->join_operator);
533533

534534
outer_order = (Oid *) palloc(sizeof(Oid) * 2);
535-
outer_order[0] = (best_path->jpath.path.p_ordering.ord.merge)->left_operator;
535+
outer_order[0] = (best_path->jpath.path.path_order.ord.merge)->left_operator;
536536
outer_order[1] = 0;
537537

538538
inner_order = (Oid *) palloc(sizeof(Oid) * 2);
539-
inner_order[0] = (best_path->jpath.path.p_ordering.ord.merge)->right_operator;
539+
inner_order[0] = (best_path->jpath.path.path_order.ord.merge)->right_operator;
540540
inner_order[1] = 0;
541541

542542
/*

0 commit comments

Comments
 (0)