1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-08 11:42:09 +03:00

Major optimizer improvement for joining a large number of tables.

This commit is contained in:
Bruce Momjian
1999-02-09 03:51:42 +00:00
parent be948af2e8
commit fe35ffe7e0
21 changed files with 277 additions and 139 deletions

View File

@ -5,7 +5,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: outfuncs.c,v 1.65 1999/02/05 19:59:25 momjian Exp $
* $Id: outfuncs.c,v 1.66 1999/02/09 03:51:13 momjian Exp $
*
* NOTES
* Every (plan) node in POSTGRES has an associated "out" routine which
@ -855,7 +855,7 @@ _outEState(StringInfo str, EState *node)
* Stuff from relation.h
*/
static void
_outRelOptInfo(StringInfo str, RelOptInfo * node)
_outRelOptInfo(StringInfo str, RelOptInfo *node)
{
appendStringInfo(str, " RELOPTINFO :relids ");
_outIntList(str, node->relids);
@ -924,6 +924,35 @@ _outRowMark(StringInfo str, RowMark *node)
appendStringInfo(str, " ROWMARK :rti %u :info %u", node->rti, node->info);
}
/*
* Path is a subclass of Node.
*/
static void
_outPathOrder(StringInfo str, PathOrder *node)
{
appendStringInfo(str, " PATHORDER :ordtype %d ",
node->ordtype);
if (node->ordtype == SORTOP_ORDER)
{
int i;
appendStringInfo(str, " :sortop ");
if (node->ord.sortop == NULL)
appendStringInfo(str, "<>");
else
{
for (i=0; node->ord.sortop[i] != 0; i++)
appendStringInfo(str, " %d ", node->ord.sortop[i]);
appendStringInfo(str, " %d ", 0);
}
}
else
{
appendStringInfo(str, " :merge ");
_outNode(str,node->ord.merge);
}
}
/*
* Path is a subclass of Node.
*/
@ -934,6 +963,9 @@ _outPath(StringInfo str, Path *node)
node->pathtype,
node->path_cost);
_outNode(str, node->keys);
appendStringInfo(str, " :path_order ");
_outNode(str, node->path_order);
}
/*
@ -948,6 +980,9 @@ _outIndexPath(StringInfo str, IndexPath *node)
node->path.path_cost);
_outNode(str, node->path.keys);
appendStringInfo(str, " :path_order ");
_outNode(str, node->path.path_order);
appendStringInfo(str, " :indexid ");
_outIntList(str, node->indexid);
@ -967,6 +1002,9 @@ _outJoinPath(StringInfo str, JoinPath *node)
node->path.path_cost);
_outNode(str, node->path.keys);
appendStringInfo(str, " :path_order ");
_outNode(str, node->path.path_order);
appendStringInfo(str, " :pathinfo ");
_outNode(str, node->pathinfo);
@ -995,6 +1033,9 @@ _outMergePath(StringInfo str, MergePath *node)
node->jpath.path.path_cost);
_outNode(str, node->jpath.path.keys);
appendStringInfo(str, " :path_order ");
_outNode(str, node->jpath.path.path_order);
appendStringInfo(str, " :pathinfo ");
_outNode(str, node->jpath.pathinfo);
@ -1032,6 +1073,9 @@ _outHashPath(StringInfo str, HashPath *node)
node->jpath.path.path_cost);
_outNode(str, node->jpath.path.keys);
appendStringInfo(str, " :path_order ");
_outNode(str, node->jpath.path.path_order);
appendStringInfo(str, " :pathinfo ");
_outNode(str, node->jpath.pathinfo);
@ -1548,6 +1592,9 @@ _outNode(StringInfo str, void *obj)
case T_RowMark:
_outRowMark(str, obj);
break;
case T_PathOrder:
_outPathOrder(str, obj);
break;
case T_Path:
_outPath(str, obj);
break;