1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-10 17:42:29 +03:00

More optimizer speedups.

This commit is contained in:
Bruce Momjian
1999-02-11 14:59:09 +00:00
parent 129543e22d
commit d244df95db
17 changed files with 192 additions and 131 deletions

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.66 1999/02/10 03:52:34 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.67 1999/02/11 14:58:48 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1093,26 +1093,26 @@ CopyPathFields(Path *from, Path *newnode)
newnode->path_cost = from->path_cost;
newnode->path_order = makeNode(PathOrder);
newnode->path_order->ordtype = from->path_order->ordtype;
if (from->path_order->ordtype == SORTOP_ORDER)
newnode->pathorder = makeNode(PathOrder);
newnode->pathorder->ordtype = from->pathorder->ordtype;
if (from->pathorder->ordtype == SORTOP_ORDER)
{
int len,
i;
Oid *ordering = from->path_order->ord.sortop;
Oid *ordering = from->pathorder->ord.sortop;
if (ordering)
{
for (len = 0; ordering[len] != 0; len++)
;
newnode->path_order->ord.sortop = (Oid *) palloc(sizeof(Oid) * (len + 1));
newnode->pathorder->ord.sortop = (Oid *) palloc(sizeof(Oid) * (len + 1));
for (i = 0; i < len; i++)
newnode->path_order->ord.sortop[i] = ordering[i];
newnode->path_order->ord.sortop[len] = 0;
newnode->pathorder->ord.sortop[i] = ordering[i];
newnode->pathorder->ord.sortop[len] = 0;
}
}
else
Node_Copy(from, newnode, path_order->ord.merge);
Node_Copy(from, newnode, pathorder->ord.merge);
Node_Copy(from, newnode, pathkeys);

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.29 1999/02/10 21:02:33 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.30 1999/02/11 14:58:48 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -337,33 +337,33 @@ _equalPath(Path *a, Path *b)
/*
* if (a->path_cost != b->path_cost) return(false);
*/
if (a->path_order->ordtype == SORTOP_ORDER)
if (a->pathorder->ordtype == SORTOP_ORDER)
{
int i = 0;
if (a->path_order->ord.sortop == NULL ||
b->path_order->ord.sortop == NULL)
if (a->pathorder->ord.sortop == NULL ||
b->pathorder->ord.sortop == NULL)
{
if (a->path_order->ord.sortop != b->path_order->ord.sortop)
if (a->pathorder->ord.sortop != b->pathorder->ord.sortop)
return false;
}
else
{
while (a->path_order->ord.sortop[i] != 0 &&
b->path_order->ord.sortop[i] != 0)
while (a->pathorder->ord.sortop[i] != 0 &&
b->pathorder->ord.sortop[i] != 0)
{
if (a->path_order->ord.sortop[i] != b->path_order->ord.sortop[i])
if (a->pathorder->ord.sortop[i] != b->pathorder->ord.sortop[i])
return false;
i++;
}
if (a->path_order->ord.sortop[i] != 0 ||
b->path_order->ord.sortop[i] != 0)
if (a->pathorder->ord.sortop[i] != 0 ||
b->pathorder->ord.sortop[i] != 0)
return false;
}
}
else
{
if (!equal(a->path_order->ord.merge, b->path_order->ord.merge))
if (!equal(a->pathorder->ord.merge, b->pathorder->ord.merge))
return false;
}
if (!equal(a->pathkeys, b->pathkeys))

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/Attic/freefuncs.c,v 1.6 1999/02/10 21:02:33 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/Attic/freefuncs.c,v 1.7 1999/02/11 14:58:49 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -756,15 +756,15 @@ _freeRelOptInfo(RelOptInfo *node)
static void
FreePathFields(Path *node)
{
if (node->path_order->ordtype == SORTOP_ORDER)
if (node->pathorder->ordtype == SORTOP_ORDER)
{
if (node->path_order->ord.sortop)
pfree(node->path_order->ord.sortop);
if (node->pathorder->ord.sortop)
pfree(node->pathorder->ord.sortop);
}
else
freeObject(node->path_order->ord.merge);
freeObject(node->pathorder->ord.merge);
pfree(node->path_order); /* is it an object, but we don't have
pfree(node->pathorder); /* is it an object, but we don't have
separate free for it */
freeObject(node->pathkeys);

View File

@@ -5,7 +5,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: outfuncs.c,v 1.68 1999/02/10 03:52:35 momjian Exp $
* $Id: outfuncs.c,v 1.69 1999/02/11 14:58:49 momjian Exp $
*
* NOTES
* Every (plan) node in POSTGRES has an associated "out" routine which
@@ -964,8 +964,8 @@ _outPath(StringInfo str, Path *node)
node->path_cost);
_outNode(str, node->pathkeys);
appendStringInfo(str, " :path_order ");
_outNode(str, node->path_order);
appendStringInfo(str, " :pathorder ");
_outNode(str, node->pathorder);
}
/*
@@ -980,8 +980,8 @@ _outIndexPath(StringInfo str, IndexPath *node)
node->path.path_cost);
_outNode(str, node->path.pathkeys);
appendStringInfo(str, " :path_order ");
_outNode(str, node->path.path_order);
appendStringInfo(str, " :pathorder ");
_outNode(str, node->path.pathorder);
appendStringInfo(str, " :indexid ");
_outIntList(str, node->indexid);
@@ -1002,8 +1002,8 @@ _outJoinPath(StringInfo str, JoinPath *node)
node->path.path_cost);
_outNode(str, node->path.pathkeys);
appendStringInfo(str, " :path_order ");
_outNode(str, node->path.path_order);
appendStringInfo(str, " :pathorder ");
_outNode(str, node->path.pathorder);
appendStringInfo(str, " :pathinfo ");
_outNode(str, node->pathinfo);
@@ -1033,8 +1033,8 @@ _outMergePath(StringInfo str, MergePath *node)
node->jpath.path.path_cost);
_outNode(str, node->jpath.path.pathkeys);
appendStringInfo(str, " :path_order ");
_outNode(str, node->jpath.path.path_order);
appendStringInfo(str, " :pathorder ");
_outNode(str, node->jpath.path.pathorder);
appendStringInfo(str, " :pathinfo ");
_outNode(str, node->jpath.pathinfo);
@@ -1073,8 +1073,8 @@ _outHashPath(StringInfo str, HashPath *node)
node->jpath.path.path_cost);
_outNode(str, node->jpath.path.pathkeys);
appendStringInfo(str, " :path_order ");
_outNode(str, node->jpath.path.path_order);
appendStringInfo(str, " :pathorder ");
_outNode(str, node->jpath.path.pathorder);
appendStringInfo(str, " :pathinfo ");
_outNode(str, node->jpath.pathinfo);

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.53 1999/02/10 03:52:36 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.54 1999/02/11 14:58:49 momjian Exp $
*
* NOTES
* Most of the read functions for plan nodes are tested. (In fact, they
@@ -1522,8 +1522,8 @@ _readPath()
token = lsptok(NULL, &length); /* now read it */
local_node->path_cost = (Cost) atof(token);
token = lsptok(NULL, &length); /* get :path_order */
local_node->path_order = nodeRead(true); /* now read it */
token = lsptok(NULL, &length); /* get :pathorder */
local_node->pathorder = nodeRead(true); /* now read it */
token = lsptok(NULL, &length); /* get :pathkeys */
local_node->pathkeys = nodeRead(true); /* now read it */
@@ -1554,8 +1554,8 @@ _readIndexPath()
token = lsptok(NULL, &length); /* now read it */
local_node->path.path_cost = (Cost) atof(token);
token = lsptok(NULL, &length); /* get :path_order */
local_node->path.path_order = nodeRead(true); /* now read it */
token = lsptok(NULL, &length); /* get :pathorder */
local_node->path.pathorder = nodeRead(true); /* now read it */
token = lsptok(NULL, &length); /* get :pathkeys */
local_node->path.pathkeys = nodeRead(true); /* now read it */
@@ -1593,8 +1593,8 @@ _readJoinPath()
token = lsptok(NULL, &length); /* now read it */
local_node->path.path_cost = (Cost) atof(token);
token = lsptok(NULL, &length); /* get :path_order */
local_node->path.path_order = nodeRead(true); /* now read it */
token = lsptok(NULL, &length); /* get :pathorder */
local_node->path.pathorder = nodeRead(true); /* now read it */
token = lsptok(NULL, &length); /* get :pathkeys */
local_node->path.pathkeys = nodeRead(true); /* now read it */
@@ -1658,8 +1658,8 @@ _readMergePath()
local_node->jpath.path.path_cost = (Cost) atof(token);
token = lsptok(NULL, &length); /* get :path_order */
local_node->jpath.path.path_order = nodeRead(true); /* now read it */
token = lsptok(NULL, &length); /* get :pathorder */
local_node->jpath.path.pathorder = nodeRead(true); /* now read it */
token = lsptok(NULL, &length); /* get :pathkeys */
local_node->jpath.path.pathkeys = nodeRead(true); /* now read it */
@@ -1732,8 +1732,8 @@ _readHashPath()
local_node->jpath.path.path_cost = (Cost) atof(token);
token = lsptok(NULL, &length); /* get :path_order */
local_node->jpath.path.path_order = nodeRead(true); /* now read it */
token = lsptok(NULL, &length); /* get :pathorder */
local_node->jpath.path.pathorder = nodeRead(true); /* now read it */
token = lsptok(NULL, &length); /* get :pathkeys */
local_node->jpath.path.pathkeys = nodeRead(true); /* now read it */