Rename Path.keys to Path.pathkeys. Too many 'keys' used for other things.
This commit is contained in:
parent
318e593f03
commit
f859c81c18
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.65 1999/02/09 17:02:46 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.66 1999/02/10 03:52:34 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -1114,7 +1114,7 @@ CopyPathFields(Path *from, Path *newnode)
|
|||||||
else
|
else
|
||||||
Node_Copy(from, newnode, path_order->ord.merge);
|
Node_Copy(from, newnode, path_order->ord.merge);
|
||||||
|
|
||||||
Node_Copy(from, newnode, keys);
|
Node_Copy(from, newnode, pathkeys);
|
||||||
|
|
||||||
newnode->outerjoincost = from->outerjoincost;
|
newnode->outerjoincost = from->outerjoincost;
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.27 1999/02/09 03:51:12 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.28 1999/02/10 03:52:35 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -366,7 +366,7 @@ _equalPath(Path *a, Path *b)
|
|||||||
if (!equal(a->path_order->ord.merge, b->path_order->ord.merge))
|
if (!equal(a->path_order->ord.merge, b->path_order->ord.merge))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!equal(a->keys, b->keys))
|
if (!equal(a->pathkeys, b->pathkeys))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/nodes/Attic/freefuncs.c,v 1.4 1999/02/09 17:02:49 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/nodes/Attic/freefuncs.c,v 1.5 1999/02/10 03:52:35 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -767,7 +767,7 @@ FreePathFields(Path *node)
|
|||||||
pfree(node->path_order); /* is it an object, but we don't have
|
pfree(node->path_order); /* is it an object, but we don't have
|
||||||
separate free for it */
|
separate free for it */
|
||||||
|
|
||||||
freeObject(node->keys);
|
freeObject(node->pathkeys);
|
||||||
|
|
||||||
freeList(node->joinid);
|
freeList(node->joinid);
|
||||||
freeObject(node->loc_restrictinfo);
|
freeObject(node->loc_restrictinfo);
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (c) 1994, Regents of the University of California
|
* Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* $Id: outfuncs.c,v 1.67 1999/02/09 17:02:49 momjian Exp $
|
* $Id: outfuncs.c,v 1.68 1999/02/10 03:52:35 momjian Exp $
|
||||||
*
|
*
|
||||||
* NOTES
|
* NOTES
|
||||||
* Every (plan) node in POSTGRES has an associated "out" routine which
|
* Every (plan) node in POSTGRES has an associated "out" routine which
|
||||||
@ -959,10 +959,10 @@ _outPathOrder(StringInfo str, PathOrder *node)
|
|||||||
static void
|
static void
|
||||||
_outPath(StringInfo str, Path *node)
|
_outPath(StringInfo str, Path *node)
|
||||||
{
|
{
|
||||||
appendStringInfo(str, " PATH :pathtype %d :cost %f :keys ",
|
appendStringInfo(str, " PATH :pathtype %d :cost %f :pathkeys ",
|
||||||
node->pathtype,
|
node->pathtype,
|
||||||
node->path_cost);
|
node->path_cost);
|
||||||
_outNode(str, node->keys);
|
_outNode(str, node->pathkeys);
|
||||||
|
|
||||||
appendStringInfo(str, " :path_order ");
|
appendStringInfo(str, " :path_order ");
|
||||||
_outNode(str, node->path_order);
|
_outNode(str, node->path_order);
|
||||||
@ -975,10 +975,10 @@ static void
|
|||||||
_outIndexPath(StringInfo str, IndexPath *node)
|
_outIndexPath(StringInfo str, IndexPath *node)
|
||||||
{
|
{
|
||||||
appendStringInfo(str,
|
appendStringInfo(str,
|
||||||
" INDEXPATH :pathtype %d :cost %f :keys ",
|
" INDEXPATH :pathtype %d :cost %f :pathkeys ",
|
||||||
node->path.pathtype,
|
node->path.pathtype,
|
||||||
node->path.path_cost);
|
node->path.path_cost);
|
||||||
_outNode(str, node->path.keys);
|
_outNode(str, node->path.pathkeys);
|
||||||
|
|
||||||
appendStringInfo(str, " :path_order ");
|
appendStringInfo(str, " :path_order ");
|
||||||
_outNode(str, node->path.path_order);
|
_outNode(str, node->path.path_order);
|
||||||
@ -997,10 +997,10 @@ static void
|
|||||||
_outJoinPath(StringInfo str, JoinPath *node)
|
_outJoinPath(StringInfo str, JoinPath *node)
|
||||||
{
|
{
|
||||||
appendStringInfo(str,
|
appendStringInfo(str,
|
||||||
" JOINPATH :pathtype %d :cost %f :keys ",
|
" JOINPATH :pathtype %d :cost %f :pathkeys ",
|
||||||
node->path.pathtype,
|
node->path.pathtype,
|
||||||
node->path.path_cost);
|
node->path.path_cost);
|
||||||
_outNode(str, node->path.keys);
|
_outNode(str, node->path.pathkeys);
|
||||||
|
|
||||||
appendStringInfo(str, " :path_order ");
|
appendStringInfo(str, " :path_order ");
|
||||||
_outNode(str, node->path.path_order);
|
_outNode(str, node->path.path_order);
|
||||||
@ -1028,10 +1028,10 @@ static void
|
|||||||
_outMergePath(StringInfo str, MergePath *node)
|
_outMergePath(StringInfo str, MergePath *node)
|
||||||
{
|
{
|
||||||
appendStringInfo(str,
|
appendStringInfo(str,
|
||||||
" MERGEPATH :pathtype %d :cost %f :keys ",
|
" MERGEPATH :pathtype %d :cost %f :pathkeys ",
|
||||||
node->jpath.path.pathtype,
|
node->jpath.path.pathtype,
|
||||||
node->jpath.path.path_cost);
|
node->jpath.path.path_cost);
|
||||||
_outNode(str, node->jpath.path.keys);
|
_outNode(str, node->jpath.path.pathkeys);
|
||||||
|
|
||||||
appendStringInfo(str, " :path_order ");
|
appendStringInfo(str, " :path_order ");
|
||||||
_outNode(str, node->jpath.path.path_order);
|
_outNode(str, node->jpath.path.path_order);
|
||||||
@ -1068,10 +1068,10 @@ static void
|
|||||||
_outHashPath(StringInfo str, HashPath *node)
|
_outHashPath(StringInfo str, HashPath *node)
|
||||||
{
|
{
|
||||||
appendStringInfo(str,
|
appendStringInfo(str,
|
||||||
" HASHPATH :pathtype %d :cost %f :keys ",
|
" HASHPATH :pathtype %d :cost %f :pathkeys ",
|
||||||
node->jpath.path.pathtype,
|
node->jpath.path.pathtype,
|
||||||
node->jpath.path.path_cost);
|
node->jpath.path.path_cost);
|
||||||
_outNode(str, node->jpath.path.keys);
|
_outNode(str, node->jpath.path.pathkeys);
|
||||||
|
|
||||||
appendStringInfo(str, " :path_order ");
|
appendStringInfo(str, " :path_order ");
|
||||||
_outNode(str, node->jpath.path.path_order);
|
_outNode(str, node->jpath.path.path_order);
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/nodes/print.c,v 1.20 1999/02/09 17:02:49 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/nodes/print.c,v 1.21 1999/02/10 03:52:36 momjian Exp $
|
||||||
*
|
*
|
||||||
* HISTORY
|
* HISTORY
|
||||||
* AUTHOR DATE MAJOR EVENT
|
* AUTHOR DATE MAJOR EVENT
|
||||||
@ -212,16 +212,16 @@ print_expr(Node *expr, List *rtable)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* print_keys -
|
* print_pathkeys -
|
||||||
* temporary here. where is keys list of list??
|
* temporary here. where is keys list of lists
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
print_keys(List *keys, List *rtable)
|
print_pathkeys(List *pathkeys, List *rtable)
|
||||||
{
|
{
|
||||||
List *k;
|
List *k;
|
||||||
|
|
||||||
printf("(");
|
printf("(");
|
||||||
foreach(k, keys)
|
foreach(k, pathkeys)
|
||||||
{
|
{
|
||||||
Node *var = lfirst((List *) lfirst(k));
|
Node *var = lfirst((List *) lfirst(k));
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.52 1999/02/09 17:02:50 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.53 1999/02/10 03:52:36 momjian Exp $
|
||||||
*
|
*
|
||||||
* NOTES
|
* NOTES
|
||||||
* Most of the read functions for plan nodes are tested. (In fact, they
|
* Most of the read functions for plan nodes are tested. (In fact, they
|
||||||
@ -1525,8 +1525,8 @@ _readPath()
|
|||||||
token = lsptok(NULL, &length); /* get :path_order */
|
token = lsptok(NULL, &length); /* get :path_order */
|
||||||
local_node->path_order = nodeRead(true); /* now read it */
|
local_node->path_order = nodeRead(true); /* now read it */
|
||||||
|
|
||||||
token = lsptok(NULL, &length); /* get :keys */
|
token = lsptok(NULL, &length); /* get :pathkeys */
|
||||||
local_node->keys = nodeRead(true); /* now read it */
|
local_node->pathkeys = nodeRead(true); /* now read it */
|
||||||
|
|
||||||
return local_node;
|
return local_node;
|
||||||
}
|
}
|
||||||
@ -1557,8 +1557,8 @@ _readIndexPath()
|
|||||||
token = lsptok(NULL, &length); /* get :path_order */
|
token = lsptok(NULL, &length); /* get :path_order */
|
||||||
local_node->path.path_order = nodeRead(true); /* now read it */
|
local_node->path.path_order = nodeRead(true); /* now read it */
|
||||||
|
|
||||||
token = lsptok(NULL, &length); /* get :keys */
|
token = lsptok(NULL, &length); /* get :pathkeys */
|
||||||
local_node->path.keys = nodeRead(true); /* now read it */
|
local_node->path.pathkeys = nodeRead(true); /* now read it */
|
||||||
|
|
||||||
token = lsptok(NULL, &length); /* get :indexid */
|
token = lsptok(NULL, &length); /* get :indexid */
|
||||||
local_node->indexid = toIntList(nodeRead(true));
|
local_node->indexid = toIntList(nodeRead(true));
|
||||||
@ -1596,8 +1596,8 @@ _readJoinPath()
|
|||||||
token = lsptok(NULL, &length); /* get :path_order */
|
token = lsptok(NULL, &length); /* get :path_order */
|
||||||
local_node->path.path_order = nodeRead(true); /* now read it */
|
local_node->path.path_order = nodeRead(true); /* now read it */
|
||||||
|
|
||||||
token = lsptok(NULL, &length); /* get :keys */
|
token = lsptok(NULL, &length); /* get :pathkeys */
|
||||||
local_node->path.keys = nodeRead(true); /* now read it */
|
local_node->path.pathkeys = nodeRead(true); /* now read it */
|
||||||
|
|
||||||
token = lsptok(NULL, &length); /* get :pathinfo */
|
token = lsptok(NULL, &length); /* get :pathinfo */
|
||||||
local_node->pathinfo = nodeRead(true); /* now read it */
|
local_node->pathinfo = nodeRead(true); /* now read it */
|
||||||
@ -1661,8 +1661,8 @@ _readMergePath()
|
|||||||
token = lsptok(NULL, &length); /* get :path_order */
|
token = lsptok(NULL, &length); /* get :path_order */
|
||||||
local_node->jpath.path.path_order = nodeRead(true); /* now read it */
|
local_node->jpath.path.path_order = nodeRead(true); /* now read it */
|
||||||
|
|
||||||
token = lsptok(NULL, &length); /* get :keys */
|
token = lsptok(NULL, &length); /* get :pathkeys */
|
||||||
local_node->jpath.path.keys = nodeRead(true); /* now read it */
|
local_node->jpath.path.pathkeys = nodeRead(true); /* now read it */
|
||||||
|
|
||||||
token = lsptok(NULL, &length); /* get :pathinfo */
|
token = lsptok(NULL, &length); /* get :pathinfo */
|
||||||
local_node->jpath.pathinfo = nodeRead(true); /* now read it */
|
local_node->jpath.pathinfo = nodeRead(true); /* now read it */
|
||||||
@ -1735,8 +1735,8 @@ _readHashPath()
|
|||||||
token = lsptok(NULL, &length); /* get :path_order */
|
token = lsptok(NULL, &length); /* get :path_order */
|
||||||
local_node->jpath.path.path_order = nodeRead(true); /* now read it */
|
local_node->jpath.path.path_order = nodeRead(true); /* now read it */
|
||||||
|
|
||||||
token = lsptok(NULL, &length); /* get :keys */
|
token = lsptok(NULL, &length); /* get :pathkeys */
|
||||||
local_node->jpath.path.keys = nodeRead(true); /* now read it */
|
local_node->jpath.path.pathkeys = nodeRead(true); /* now read it */
|
||||||
|
|
||||||
token = lsptok(NULL, &length); /* get :pathinfo */
|
token = lsptok(NULL, &length); /* get :pathinfo */
|
||||||
local_node->jpath.pathinfo = nodeRead(true); /* now read it */
|
local_node->jpath.pathinfo = nodeRead(true); /* now read it */
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (c) 1994, Regents of the University of California
|
* Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* $Id: geqo_misc.c,v 1.12 1999/02/03 20:15:27 momjian Exp $
|
* $Id: geqo_misc.c,v 1.13 1999/02/10 03:52:37 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -240,8 +240,8 @@ geqo_print_path(Query *root, Path *path, int indent)
|
|||||||
List *k,
|
List *k,
|
||||||
*l;
|
*l;
|
||||||
|
|
||||||
printf(" keys=");
|
printf(" pathkeys=");
|
||||||
foreach(k, path->keys)
|
foreach(k, path->pathkeys)
|
||||||
{
|
{
|
||||||
printf("(");
|
printf("(");
|
||||||
foreach(l, lfirst(k))
|
foreach(l, lfirst(k))
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/allpaths.c,v 1.25 1999/02/03 20:15:28 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/allpaths.c,v 1.26 1999/02/10 03:52:38 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -383,8 +383,8 @@ print_path(Query *root, Path *path, int indent)
|
|||||||
List *k,
|
List *k,
|
||||||
*l;
|
*l;
|
||||||
|
|
||||||
printf(" keys=");
|
printf(" pathkeys=");
|
||||||
foreach(k, path->keys)
|
foreach(k, path->pathkeys)
|
||||||
{
|
{
|
||||||
printf("(");
|
printf("(");
|
||||||
foreach(l, lfirst(k))
|
foreach(l, lfirst(k))
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.27 1999/02/09 17:02:52 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.28 1999/02/10 03:52:39 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -164,7 +164,7 @@ cost_index(Oid indexid,
|
|||||||
* 2. the cost of reading the sort result into memory (another seqscan)
|
* 2. the cost of reading the sort result into memory (another seqscan)
|
||||||
* unless 'noread' is set
|
* unless 'noread' is set
|
||||||
*
|
*
|
||||||
* 'keys' is a list of sort keys
|
* 'pathkeys' is a list of sort keys
|
||||||
* 'tuples' is the number of tuples in the relation
|
* 'tuples' is the number of tuples in the relation
|
||||||
* 'width' is the average tuple width in bytes
|
* 'width' is the average tuple width in bytes
|
||||||
* 'noread' is a flag indicating that the sort result can remain on disk
|
* 'noread' is a flag indicating that the sort result can remain on disk
|
||||||
@ -174,7 +174,7 @@ cost_index(Oid indexid,
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
Cost
|
Cost
|
||||||
cost_sort(List *keys, int tuples, int width, bool noread)
|
cost_sort(List *pathkeys, int tuples, int width, bool noread)
|
||||||
{
|
{
|
||||||
Cost temp = 0;
|
Cost temp = 0;
|
||||||
int npages = page_size(tuples, width);
|
int npages = page_size(tuples, width);
|
||||||
@ -183,7 +183,7 @@ cost_sort(List *keys, int tuples, int width, bool noread)
|
|||||||
|
|
||||||
if (!_enable_sort_)
|
if (!_enable_sort_)
|
||||||
temp += _disable_cost_;
|
temp += _disable_cost_;
|
||||||
if (tuples == 0 || keys == NULL)
|
if (tuples == 0 || pathkeys == NULL)
|
||||||
{
|
{
|
||||||
Assert(temp >= 0);
|
Assert(temp >= 0);
|
||||||
return temp;
|
return temp;
|
||||||
@ -194,8 +194,8 @@ cost_sort(List *keys, int tuples, int width, bool noread)
|
|||||||
* could be base_log(pages, NBuffers), but we are only doing 2-way
|
* could be base_log(pages, NBuffers), but we are only doing 2-way
|
||||||
* merges
|
* merges
|
||||||
*/
|
*/
|
||||||
temp += _cpu_page_wight_ *
|
temp += _cpu_page_wight_ * numTuples *
|
||||||
numTuples * base_log((double) pages, (double) 2.0);
|
base_log((double) pages, (double) 2.0);
|
||||||
|
|
||||||
if (!noread)
|
if (!noread)
|
||||||
temp = temp + cost_seqscan(_NONAME_RELATION_ID_, npages, tuples);
|
temp = temp + cost_seqscan(_NONAME_RELATION_ID_, npages, tuples);
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/hashutils.c,v 1.11 1999/02/04 03:19:08 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/hashutils.c,v 1.12 1999/02/10 03:52:39 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -58,21 +58,21 @@ group_clauses_by_hashop(List *restrictinfo_list,
|
|||||||
Expr *clause = restrictinfo->clause;
|
Expr *clause = restrictinfo->clause;
|
||||||
Var *leftop = get_leftop(clause);
|
Var *leftop = get_leftop(clause);
|
||||||
Var *rightop = get_rightop(clause);
|
Var *rightop = get_rightop(clause);
|
||||||
JoinKey *keys = (JoinKey *) NULL;
|
JoinKey *joinkey = (JoinKey *) NULL;
|
||||||
|
|
||||||
xhashinfo = match_hashop_hashinfo(hashjoinop, hashinfo_list);
|
xhashinfo = match_hashop_hashinfo(hashjoinop, hashinfo_list);
|
||||||
|
|
||||||
if (inner_relid == leftop->varno)
|
if (inner_relid == leftop->varno)
|
||||||
{
|
{
|
||||||
keys = makeNode(JoinKey);
|
joinkey = makeNode(JoinKey);
|
||||||
keys->outer = rightop;
|
joinkey->outer = rightop;
|
||||||
keys->inner = leftop;
|
joinkey->inner = leftop;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
keys = makeNode(JoinKey);
|
joinkey = makeNode(JoinKey);
|
||||||
keys->outer = leftop;
|
joinkey->outer = leftop;
|
||||||
keys->inner = rightop;
|
joinkey->inner = rightop;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (xhashinfo == NULL)
|
if (xhashinfo == NULL)
|
||||||
@ -90,7 +90,7 @@ group_clauses_by_hashop(List *restrictinfo_list,
|
|||||||
|
|
||||||
xhashinfo->jmethod.clauses = lcons(clause, xhashinfo->jmethod.clauses);
|
xhashinfo->jmethod.clauses = lcons(clause, xhashinfo->jmethod.clauses);
|
||||||
|
|
||||||
xhashinfo->jmethod.jmkeys = lcons(keys, xhashinfo->jmethod.jmkeys);
|
xhashinfo->jmethod.jmkeys = lcons(joinkey, xhashinfo->jmethod.jmkeys);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return hashinfo_list;
|
return hashinfo_list;
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.40 1999/02/09 03:51:17 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.41 1999/02/10 03:52:39 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -144,7 +144,7 @@ find_index_paths(Query *root,
|
|||||||
* restriction clauses, then create pathnodes corresponding to
|
* restriction clauses, then create pathnodes corresponding to
|
||||||
* each group of usable clauses.
|
* each group of usable clauses.
|
||||||
*/
|
*/
|
||||||
scanclausegroups = group_clauses_by_indexkey(rel,
|
scanclausegroups = group_clauses_by_indexkey(rel,
|
||||||
index,
|
index,
|
||||||
index->indexkeys,
|
index->indexkeys,
|
||||||
index->classlist,
|
index->classlist,
|
||||||
@ -1293,7 +1293,7 @@ index_innerjoin(Query *root, RelOptInfo * rel, List *clausegroup_list,
|
|||||||
pathnode->path.path_order = makeNode(PathOrder);
|
pathnode->path.path_order = makeNode(PathOrder);
|
||||||
pathnode->path.path_order->ordtype = SORTOP_ORDER;
|
pathnode->path.path_order->ordtype = SORTOP_ORDER;
|
||||||
pathnode->path.path_order->ord.sortop = index->ordering;
|
pathnode->path.path_order->ord.sortop = index->ordering;
|
||||||
pathnode->path.keys = NIL; /* not sure about this, bjm 1998/09/21 */
|
pathnode->path.pathkeys = NIL;
|
||||||
|
|
||||||
pathnode->indexid = index->relids;
|
pathnode->indexid = index->relids;
|
||||||
pathnode->indexkeys = index->indexkeys;
|
pathnode->indexkeys = index->indexkeys;
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinpath.c,v 1.16 1999/02/09 03:51:19 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinpath.c,v 1.17 1999/02/10 03:52:40 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -341,19 +341,19 @@ match_unsorted_outer(RelOptInfo * joinrel,
|
|||||||
|
|
||||||
if (clauses)
|
if (clauses)
|
||||||
{
|
{
|
||||||
List *keys = xmergeinfo->jmethod.jmkeys;
|
List *jmkeys = xmergeinfo->jmethod.jmkeys;
|
||||||
List *clauses = xmergeinfo->jmethod.clauses;
|
List *clauses = xmergeinfo->jmethod.clauses;
|
||||||
|
|
||||||
matchedJoinKeys = match_pathkeys_joinkeys(outerpath->keys,
|
matchedJoinKeys = match_pathkeys_joinkeys(outerpath->pathkeys,
|
||||||
keys,
|
jmkeys,
|
||||||
clauses,
|
clauses,
|
||||||
OUTER,
|
OUTER,
|
||||||
&matchedJoinClauses);
|
&matchedJoinClauses);
|
||||||
merge_pathkeys = new_join_pathkeys(outerpath->keys,
|
merge_pathkeys = new_join_pathkeys(outerpath->pathkeys,
|
||||||
joinrel->targetlist, clauses);
|
joinrel->targetlist, clauses);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
merge_pathkeys = outerpath->keys;
|
merge_pathkeys = outerpath->pathkeys;
|
||||||
|
|
||||||
if (best_innerjoin &&
|
if (best_innerjoin &&
|
||||||
path_is_cheaper(best_innerjoin, cheapest_inner))
|
path_is_cheaper(best_innerjoin, cheapest_inner))
|
||||||
@ -415,7 +415,7 @@ match_unsorted_outer(RelOptInfo * joinrel,
|
|||||||
matchedJoinClauses,
|
matchedJoinClauses,
|
||||||
NIL,
|
NIL,
|
||||||
varkeys),
|
varkeys),
|
||||||
paths);
|
paths);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
temp_node = paths;
|
temp_node = paths;
|
||||||
@ -484,11 +484,11 @@ match_unsorted_inner(RelOptInfo * joinrel,
|
|||||||
|
|
||||||
if (clauses)
|
if (clauses)
|
||||||
{
|
{
|
||||||
List *keys = xmergeinfo->jmethod.jmkeys;
|
List *jmkeys = xmergeinfo->jmethod.jmkeys;
|
||||||
List *cls = xmergeinfo->jmethod.clauses;
|
List *cls = xmergeinfo->jmethod.clauses;
|
||||||
|
|
||||||
matchedJoinKeys = match_pathkeys_joinkeys(innerpath->keys,
|
matchedJoinKeys = match_pathkeys_joinkeys(innerpath->pathkeys,
|
||||||
keys,
|
jmkeys,
|
||||||
cls,
|
cls,
|
||||||
INNER,
|
INNER,
|
||||||
&matchedJoinClauses);
|
&matchedJoinClauses);
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/joinutils.c,v 1.13 1999/02/09 17:02:55 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/joinutils.c,v 1.14 1999/02/10 03:52:40 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -44,7 +44,7 @@ static List *new_matching_subkeys(Var *subkey, List *considered_subkeys,
|
|||||||
* match-pathkeys-joinkeys--
|
* match-pathkeys-joinkeys--
|
||||||
* Attempts to match the keys of a path against the keys of join clauses.
|
* Attempts to match the keys of a path against the keys of join clauses.
|
||||||
* This is done by looking for a matching join key in 'joinkeys' for
|
* This is done by looking for a matching join key in 'joinkeys' for
|
||||||
* every path key in the list 'pathkeys'. If there is a matching join key
|
* every path key in the list 'path.keys'. If there is a matching join key
|
||||||
* (not necessarily unique) for every path key, then the list of
|
* (not necessarily unique) for every path key, then the list of
|
||||||
* corresponding join keys and join clauses are returned in the order in
|
* corresponding join keys and join clauses are returned in the order in
|
||||||
* which the keys matched the path keys.
|
* which the keys matched the path keys.
|
||||||
@ -216,10 +216,10 @@ match_paths_joinkeys(List *joinkeys,
|
|||||||
{
|
{
|
||||||
Path *path = (Path *) lfirst(i);
|
Path *path = (Path *) lfirst(i);
|
||||||
|
|
||||||
key_match = every_func(joinkeys, path->keys, which_subkey);
|
key_match = every_func(joinkeys, path->pathkeys, which_subkey);
|
||||||
|
|
||||||
if (equal_path_ordering(ordering, path->path_order) &&
|
if (equal_path_ordering(ordering, path->path_order) &&
|
||||||
length(joinkeys) == length(path->keys) &&
|
length(joinkeys) == length(path->pathkeys) &&
|
||||||
key_match)
|
key_match)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -249,7 +249,7 @@ match_paths_joinkeys(List *joinkeys,
|
|||||||
* in 'joinkeys'
|
* in 'joinkeys'
|
||||||
*
|
*
|
||||||
* Returns a list of pathkeys: ((tlvar1)(tlvar2)...(tlvarN)).
|
* Returns a list of pathkeys: ((tlvar1)(tlvar2)...(tlvarN)).
|
||||||
* [I've no idea why they have to be list of lists. Should be fixed. -ay 12/94]
|
* It is a list of lists because of multi-key indexes.
|
||||||
*/
|
*/
|
||||||
List *
|
List *
|
||||||
extract_path_keys(List *joinkeys,
|
extract_path_keys(List *joinkeys,
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/mergeutils.c,v 1.15 1999/02/09 03:51:20 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/mergeutils.c,v 1.16 1999/02/10 03:52:41 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -57,7 +57,7 @@ group_clauses_by_order(List *restrictinfo_list,
|
|||||||
Expr *clause = restrictinfo->clause;
|
Expr *clause = restrictinfo->clause;
|
||||||
Var *leftop = get_leftop(clause);
|
Var *leftop = get_leftop(clause);
|
||||||
Var *rightop = get_rightop(clause);
|
Var *rightop = get_rightop(clause);
|
||||||
JoinKey *keys;
|
JoinKey *jmkeys;
|
||||||
|
|
||||||
path_order = makeNode(PathOrder);
|
path_order = makeNode(PathOrder);
|
||||||
path_order->ordtype = MERGE_ORDER;
|
path_order->ordtype = MERGE_ORDER;
|
||||||
@ -65,15 +65,15 @@ group_clauses_by_order(List *restrictinfo_list,
|
|||||||
xmergeinfo = match_order_mergeinfo(path_order, mergeinfo_list);
|
xmergeinfo = match_order_mergeinfo(path_order, mergeinfo_list);
|
||||||
if (inner_relid == leftop->varno)
|
if (inner_relid == leftop->varno)
|
||||||
{
|
{
|
||||||
keys = makeNode(JoinKey);
|
jmkeys = makeNode(JoinKey);
|
||||||
keys->outer = rightop;
|
jmkeys->outer = rightop;
|
||||||
keys->inner = leftop;
|
jmkeys->inner = leftop;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
keys = makeNode(JoinKey);
|
jmkeys = makeNode(JoinKey);
|
||||||
keys->outer = leftop;
|
jmkeys->outer = leftop;
|
||||||
keys->inner = rightop;
|
jmkeys->inner = rightop;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (xmergeinfo == NULL)
|
if (xmergeinfo == NULL)
|
||||||
@ -87,7 +87,7 @@ group_clauses_by_order(List *restrictinfo_list,
|
|||||||
|
|
||||||
((JoinMethod *) xmergeinfo)->clauses = lcons(clause,
|
((JoinMethod *) xmergeinfo)->clauses = lcons(clause,
|
||||||
((JoinMethod *) xmergeinfo)->clauses);
|
((JoinMethod *) xmergeinfo)->clauses);
|
||||||
((JoinMethod *) xmergeinfo)->jmkeys = lcons(keys,
|
((JoinMethod *) xmergeinfo)->jmkeys = lcons(jmkeys,
|
||||||
((JoinMethod *) xmergeinfo)->jmkeys);
|
((JoinMethod *) xmergeinfo)->jmkeys);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/orindxpath.c,v 1.16 1999/02/09 03:51:20 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/orindxpath.c,v 1.17 1999/02/10 03:52:41 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -112,7 +112,7 @@ create_or_index_paths(Query *root,
|
|||||||
* not in any order, so the sortop is NULL.
|
* not in any order, so the sortop is NULL.
|
||||||
*/
|
*/
|
||||||
pathnode->path.path_order->ord.sortop = NULL;
|
pathnode->path.path_order->ord.sortop = NULL;
|
||||||
pathnode->path.keys = NIL; /* not sure about this, bjm 1998/09/21 */
|
pathnode->path.pathkeys = NIL;
|
||||||
|
|
||||||
pathnode->indexqual = lcons(clausenode, NIL);
|
pathnode->indexqual = lcons(clausenode, NIL);
|
||||||
pathnode->indexid = indexids;
|
pathnode->indexid = indexids;
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.40 1999/02/09 17:02:55 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.41 1999/02/10 03:52:44 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -60,7 +60,7 @@ static HashJoin *create_hashjoin_node(HashPath *best_path, List *tlist,
|
|||||||
List *clauses, Plan *outer_node, List *outer_tlist,
|
List *clauses, Plan *outer_node, List *outer_tlist,
|
||||||
Plan *inner_node, List *inner_tlist);
|
Plan *inner_node, List *inner_tlist);
|
||||||
static Node *fix_indxqual_references(Node *clause, Path *index_path);
|
static Node *fix_indxqual_references(Node *clause, Path *index_path);
|
||||||
static Noname *make_noname(List *tlist, List *keys, Oid *operators,
|
static Noname *make_noname(List *tlist, List *pathkeys, Oid *operators,
|
||||||
Plan *plan_node, int nonametype);
|
Plan *plan_node, int nonametype);
|
||||||
static IndexScan *make_indexscan(List *qptlist, List *qpqual, Index scanrelid,
|
static IndexScan *make_indexscan(List *qptlist, List *qpqual, Index scanrelid,
|
||||||
List *indxid, List *indxqual, List *indxqualorig, Cost cost);
|
List *indxid, List *indxqual, List *indxqualorig, Cost cost);
|
||||||
@ -814,19 +814,19 @@ switch_outer(List *clauses)
|
|||||||
static List *
|
static List *
|
||||||
set_noname_tlist_operators(List *tlist, List *pathkeys, Oid *operators)
|
set_noname_tlist_operators(List *tlist, List *pathkeys, Oid *operators)
|
||||||
{
|
{
|
||||||
Node *keys = NULL;
|
Node *pathkey = NULL;
|
||||||
int keyno = 1;
|
int keyno = 1;
|
||||||
Resdom *resdom = (Resdom *) NULL;
|
Resdom *resdom = (Resdom *) NULL;
|
||||||
List *i = NIL;
|
List *i = NIL;
|
||||||
|
|
||||||
foreach(i, pathkeys)
|
foreach(i, pathkeys)
|
||||||
{
|
{
|
||||||
keys = lfirst((List *) lfirst(i));
|
pathkey = lfirst((List *) lfirst(i));
|
||||||
resdom = tlist_member((Var *) keys, tlist);
|
resdom = tlist_member((Var *) pathkey, tlist);
|
||||||
if (resdom)
|
if (resdom)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Order the resdom keys and replace the operator OID for each
|
* Order the resdom pathkey and replace the operator OID for each
|
||||||
* key with the regproc OID.
|
* key with the regproc OID.
|
||||||
*
|
*
|
||||||
* XXX Note that the optimizer only generates merge joins with 1
|
* XXX Note that the optimizer only generates merge joins with 1
|
||||||
@ -852,7 +852,7 @@ set_noname_tlist_operators(List *tlist, List *pathkeys, Oid *operators)
|
|||||||
* or (SEQSCAN(MATERIAL(plan-node)))
|
* or (SEQSCAN(MATERIAL(plan-node)))
|
||||||
*
|
*
|
||||||
* 'tlist' is the target list of the scan to be sorted or hashed
|
* 'tlist' is the target list of the scan to be sorted or hashed
|
||||||
* 'keys' is the list of keys which the sort or hash will be done on
|
* 'pathkeys' is the list of keys which the sort or hash will be done on
|
||||||
* 'operators' is the operators with which the sort or hash is to be done
|
* 'operators' is the operators with which the sort or hash is to be done
|
||||||
* (a list of operator OIDs)
|
* (a list of operator OIDs)
|
||||||
* 'plan-node' is the node which yields tuples for the sort
|
* 'plan-node' is the node which yields tuples for the sort
|
||||||
@ -860,7 +860,7 @@ set_noname_tlist_operators(List *tlist, List *pathkeys, Oid *operators)
|
|||||||
*/
|
*/
|
||||||
static Noname *
|
static Noname *
|
||||||
make_noname(List *tlist,
|
make_noname(List *tlist,
|
||||||
List *keys,
|
List *pathkeys,
|
||||||
Oid *operators,
|
Oid *operators,
|
||||||
Plan *plan_node,
|
Plan *plan_node,
|
||||||
int nonametype)
|
int nonametype)
|
||||||
@ -870,7 +870,7 @@ make_noname(List *tlist,
|
|||||||
|
|
||||||
/* Create a new target list for the noname, with keys set. */
|
/* Create a new target list for the noname, with keys set. */
|
||||||
noname_tlist = set_noname_tlist_operators(new_unsorted_tlist(tlist),
|
noname_tlist = set_noname_tlist_operators(new_unsorted_tlist(tlist),
|
||||||
keys,
|
pathkeys,
|
||||||
operators);
|
operators);
|
||||||
switch (nonametype)
|
switch (nonametype)
|
||||||
{
|
{
|
||||||
@ -881,7 +881,7 @@ make_noname(List *tlist,
|
|||||||
(Plan *) make_sort(noname_tlist,
|
(Plan *) make_sort(noname_tlist,
|
||||||
_NONAME_RELATION_ID_,
|
_NONAME_RELATION_ID_,
|
||||||
plan_node,
|
plan_node,
|
||||||
length(keys)));
|
length(pathkeys)));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NONAME_MATERIAL:
|
case NONAME_MATERIAL:
|
||||||
@ -891,7 +891,7 @@ make_noname(List *tlist,
|
|||||||
(Plan *) make_material(noname_tlist,
|
(Plan *) make_material(noname_tlist,
|
||||||
_NONAME_RELATION_ID_,
|
_NONAME_RELATION_ID_,
|
||||||
plan_node,
|
plan_node,
|
||||||
length(keys)));
|
length(pathkeys)));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/keys.c,v 1.12 1999/02/09 06:30:39 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/keys.c,v 1.13 1999/02/10 03:52:47 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -207,8 +207,7 @@ collect_index_pathkeys(int *index_keys, List *tlist)
|
|||||||
tlist,
|
tlist,
|
||||||
equal_indexkey_var);
|
equal_indexkey_var);
|
||||||
if (mvar)
|
if (mvar)
|
||||||
retval = nconc(retval, lcons(lcons(mvar, NIL),
|
retval = lappend(retval, lcons(mvar, NIL));
|
||||||
NIL));
|
|
||||||
index_keys++;
|
index_keys++;
|
||||||
}
|
}
|
||||||
return retval;
|
return retval;
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/pathnode.c,v 1.21 1999/02/09 03:51:27 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/pathnode.c,v 1.22 1999/02/10 03:52:47 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -165,15 +165,15 @@ better_path(Path *new_path, List *unique_paths, bool *noOther)
|
|||||||
path = (Path *) lfirst(temp);
|
path = (Path *) lfirst(temp);
|
||||||
|
|
||||||
#ifdef OPTDUP_DEBUG
|
#ifdef OPTDUP_DEBUG
|
||||||
if (!samekeys(path->keys, new_path->keys))
|
if (!samekeys(path->pathkeys, new_path->pathkeys))
|
||||||
{
|
{
|
||||||
printf("oldpath\n");
|
printf("oldpath\n");
|
||||||
pprint(path->keys);
|
pprint(path->pathkeys);
|
||||||
printf("newpath\n");
|
printf("newpath\n");
|
||||||
pprint(new_path->keys);
|
pprint(new_path->pathkeys);
|
||||||
if (path->keys && new_path->keys &&
|
if (path->pathkeys && new_path->pathkeys &&
|
||||||
length(lfirst(path->keys)) >= 2 &&
|
length(lfirst(path->pathkeys)) >= 2 &&
|
||||||
length(lfirst(path->keys)) < length(lfirst(new_path->keys)))
|
length(lfirst(path->pathkeys)) < length(lfirst(new_path->pathkeys)))
|
||||||
sleep(0); /* set breakpoint here */
|
sleep(0); /* set breakpoint here */
|
||||||
}
|
}
|
||||||
if (!equal_path_ordering(path->path_order,
|
if (!equal_path_ordering(path->path_order,
|
||||||
@ -186,7 +186,7 @@ better_path(Path *new_path, List *unique_paths, bool *noOther)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (samekeys(path->keys, new_path->keys) &&
|
if (samekeys(path->pathkeys, new_path->pathkeys) &&
|
||||||
equal_path_ordering(path->path_order,
|
equal_path_ordering(path->path_order,
|
||||||
new_path->path_order))
|
new_path->path_order))
|
||||||
{
|
{
|
||||||
@ -232,7 +232,7 @@ create_seqscan_path(RelOptInfo * rel)
|
|||||||
pathnode->path_order = makeNode(PathOrder);
|
pathnode->path_order = makeNode(PathOrder);
|
||||||
pathnode->path_order->ordtype = SORTOP_ORDER;
|
pathnode->path_order->ordtype = SORTOP_ORDER;
|
||||||
pathnode->path_order->ord.sortop = NULL;
|
pathnode->path_order->ord.sortop = NULL;
|
||||||
pathnode->keys = NIL;
|
pathnode->pathkeys = NIL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* copy restrictinfo list into path for expensive function processing --
|
* copy restrictinfo list into path for expensive function processing --
|
||||||
@ -300,7 +300,7 @@ create_index_path(Query *root,
|
|||||||
*/
|
*/
|
||||||
if (pathnode->path.path_order->ord.sortop)
|
if (pathnode->path.path_order->ord.sortop)
|
||||||
{
|
{
|
||||||
pathnode->path.keys = collect_index_pathkeys(index->indexkeys,
|
pathnode->path.pathkeys = collect_index_pathkeys(index->indexkeys,
|
||||||
rel->targetlist);
|
rel->targetlist);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -309,11 +309,11 @@ create_index_path(Query *root,
|
|||||||
* relevant to the scan are not applied to the scan path node, so
|
* relevant to the scan are not applied to the scan path node, so
|
||||||
* if no index keys were found, we can't order the path).
|
* if no index keys were found, we can't order the path).
|
||||||
*/
|
*/
|
||||||
if (pathnode->path.keys == NULL)
|
if (pathnode->path.pathkeys == NULL)
|
||||||
pathnode->path.path_order->ord.sortop = NULL;
|
pathnode->path.path_order->ord.sortop = NULL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
pathnode->path.keys = NULL;
|
pathnode->path.pathkeys = NULL;
|
||||||
|
|
||||||
if (is_join_scan || restriction_clauses == NULL)
|
if (is_join_scan || restriction_clauses == NULL)
|
||||||
{
|
{
|
||||||
@ -413,7 +413,7 @@ create_index_path(Query *root,
|
|||||||
* 'outer_rel' is the outer join relation
|
* 'outer_rel' is the outer join relation
|
||||||
* 'outer_path' is the outer join path.
|
* 'outer_path' is the outer join path.
|
||||||
* 'inner_path' is the inner join path.
|
* 'inner_path' is the inner join path.
|
||||||
* 'keys' are the keys of the path
|
* 'pathkeys' are the keys of the path
|
||||||
*
|
*
|
||||||
* Returns the resulting path node.
|
* Returns the resulting path node.
|
||||||
*
|
*
|
||||||
@ -423,7 +423,7 @@ create_nestloop_path(RelOptInfo * joinrel,
|
|||||||
RelOptInfo * outer_rel,
|
RelOptInfo * outer_rel,
|
||||||
Path *outer_path,
|
Path *outer_path,
|
||||||
Path *inner_path,
|
Path *inner_path,
|
||||||
List *keys)
|
List *pathkeys)
|
||||||
{
|
{
|
||||||
JoinPath *pathnode = makeNode(JoinPath);
|
JoinPath *pathnode = makeNode(JoinPath);
|
||||||
|
|
||||||
@ -432,13 +432,13 @@ create_nestloop_path(RelOptInfo * joinrel,
|
|||||||
pathnode->outerjoinpath = outer_path;
|
pathnode->outerjoinpath = outer_path;
|
||||||
pathnode->innerjoinpath = inner_path;
|
pathnode->innerjoinpath = inner_path;
|
||||||
pathnode->pathinfo = joinrel->restrictinfo;
|
pathnode->pathinfo = joinrel->restrictinfo;
|
||||||
pathnode->path.keys = keys;
|
pathnode->path.pathkeys = pathkeys;
|
||||||
pathnode->path.joinid = NIL;
|
pathnode->path.joinid = NIL;
|
||||||
pathnode->path.outerjoincost = (Cost) 0.0;
|
pathnode->path.outerjoincost = (Cost) 0.0;
|
||||||
pathnode->path.loc_restrictinfo = NIL;
|
pathnode->path.loc_restrictinfo = NIL;
|
||||||
pathnode->path.path_order = makeNode(PathOrder);
|
pathnode->path.path_order = makeNode(PathOrder);
|
||||||
|
|
||||||
if (keys)
|
if (pathkeys)
|
||||||
{
|
{
|
||||||
pathnode->path.path_order->ordtype = outer_path->path_order->ordtype;
|
pathnode->path.path_order->ordtype = outer_path->path_order->ordtype;
|
||||||
if (outer_path->path_order->ordtype == SORTOP_ORDER)
|
if (outer_path->path_order->ordtype == SORTOP_ORDER)
|
||||||
@ -479,7 +479,7 @@ create_nestloop_path(RelOptInfo * joinrel,
|
|||||||
* 'innerwidth' is the number of bytes per tuple in the inner relation
|
* 'innerwidth' is the number of bytes per tuple in the inner relation
|
||||||
* 'outer_path' is the outer path
|
* 'outer_path' is the outer path
|
||||||
* 'inner_path' is the inner path
|
* 'inner_path' is the inner path
|
||||||
* 'keys' are the new keys of the join relation
|
* 'pathkeys' are the new keys of the join relation
|
||||||
* 'order' is the sort order required for the merge
|
* 'order' is the sort order required for the merge
|
||||||
* 'mergeclauses' are the applicable join/restriction clauses
|
* 'mergeclauses' are the applicable join/restriction clauses
|
||||||
* 'outersortkeys' are the sort varkeys for the outer relation
|
* 'outersortkeys' are the sort varkeys for the outer relation
|
||||||
@ -494,7 +494,7 @@ create_mergejoin_path(RelOptInfo * joinrel,
|
|||||||
int innerwidth,
|
int innerwidth,
|
||||||
Path *outer_path,
|
Path *outer_path,
|
||||||
Path *inner_path,
|
Path *inner_path,
|
||||||
List *keys,
|
List *pathkeys,
|
||||||
MergeOrder *order,
|
MergeOrder *order,
|
||||||
List *mergeclauses,
|
List *mergeclauses,
|
||||||
List *outersortkeys,
|
List *outersortkeys,
|
||||||
@ -507,7 +507,7 @@ create_mergejoin_path(RelOptInfo * joinrel,
|
|||||||
pathnode->jpath.outerjoinpath = outer_path;
|
pathnode->jpath.outerjoinpath = outer_path;
|
||||||
pathnode->jpath.innerjoinpath = inner_path;
|
pathnode->jpath.innerjoinpath = inner_path;
|
||||||
pathnode->jpath.pathinfo = joinrel->restrictinfo;
|
pathnode->jpath.pathinfo = joinrel->restrictinfo;
|
||||||
pathnode->jpath.path.keys = keys;
|
pathnode->jpath.path.pathkeys = pathkeys;
|
||||||
pathnode->jpath.path.path_order = makeNode(PathOrder);
|
pathnode->jpath.path.path_order = makeNode(PathOrder);
|
||||||
pathnode->jpath.path.path_order->ordtype = MERGE_ORDER;
|
pathnode->jpath.path.path_order->ordtype = MERGE_ORDER;
|
||||||
pathnode->jpath.path.path_order->ord.merge = order;
|
pathnode->jpath.path.path_order->ord.merge = order;
|
||||||
@ -544,7 +544,7 @@ create_mergejoin_path(RelOptInfo * joinrel,
|
|||||||
* 'innerwidth' is the number of bytes per tuple in the inner relation
|
* 'innerwidth' is the number of bytes per tuple in the inner relation
|
||||||
* 'outer_path' is the outer path
|
* 'outer_path' is the outer path
|
||||||
* 'inner_path' is the inner path
|
* 'inner_path' is the inner path
|
||||||
* 'keys' are the new keys of the join relation
|
* 'pathkeys' are the new keys of the join relation
|
||||||
* 'operator' is the hashjoin operator
|
* 'operator' is the hashjoin operator
|
||||||
* 'hashclauses' are the applicable join/restriction clauses
|
* 'hashclauses' are the applicable join/restriction clauses
|
||||||
* 'outerkeys' are the sort varkeys for the outer relation
|
* 'outerkeys' are the sort varkeys for the outer relation
|
||||||
@ -559,7 +559,7 @@ create_hashjoin_path(RelOptInfo * joinrel,
|
|||||||
int innerwidth,
|
int innerwidth,
|
||||||
Path *outer_path,
|
Path *outer_path,
|
||||||
Path *inner_path,
|
Path *inner_path,
|
||||||
List *keys,
|
List *pathkeys,
|
||||||
Oid operator,
|
Oid operator,
|
||||||
List *hashclauses,
|
List *hashclauses,
|
||||||
List *outerkeys,
|
List *outerkeys,
|
||||||
@ -573,7 +573,7 @@ create_hashjoin_path(RelOptInfo * joinrel,
|
|||||||
pathnode->jpath.innerjoinpath = inner_path;
|
pathnode->jpath.innerjoinpath = inner_path;
|
||||||
pathnode->jpath.pathinfo = joinrel->restrictinfo;
|
pathnode->jpath.pathinfo = joinrel->restrictinfo;
|
||||||
pathnode->jpath.path.loc_restrictinfo = NIL;
|
pathnode->jpath.path.loc_restrictinfo = NIL;
|
||||||
pathnode->jpath.path.keys = keys;
|
pathnode->jpath.path.pathkeys = pathkeys;
|
||||||
pathnode->jpath.path.path_order = makeNode(PathOrder);
|
pathnode->jpath.path.path_order = makeNode(PathOrder);
|
||||||
pathnode->jpath.path.path_order->ordtype = SORTOP_ORDER;
|
pathnode->jpath.path.path_order->ordtype = SORTOP_ORDER;
|
||||||
pathnode->jpath.path.path_order->ord.sortop = NULL;
|
pathnode->jpath.path.path_order->ord.sortop = NULL;
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (c) 1994, Regents of the University of California
|
* Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* $Id: print.h,v 1.8 1998/09/01 04:36:48 momjian Exp $
|
* $Id: print.h,v 1.9 1999/02/10 03:52:49 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -23,7 +23,7 @@ extern void print(void *obj);
|
|||||||
extern void pprint(void *obj);
|
extern void pprint(void *obj);
|
||||||
extern void print_rt(List *rtable);
|
extern void print_rt(List *rtable);
|
||||||
extern void print_expr(Node *expr, List *rtable);
|
extern void print_expr(Node *expr, List *rtable);
|
||||||
extern void print_keys(List *keys, List *rtable);
|
extern void print_pathkeys(List *pathkeys, List *rtable);
|
||||||
extern void print_tl(List *tlist, List *rtable);
|
extern void print_tl(List *tlist, List *rtable);
|
||||||
extern void print_slot(TupleTableSlot *slot);
|
extern void print_slot(TupleTableSlot *slot);
|
||||||
extern void print_plan_recursive(Plan *p, Query *parsetree,
|
extern void print_plan_recursive(Plan *p, Query *parsetree,
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (c) 1994, Regents of the University of California
|
* Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* $Id: relation.h,v 1.17 1999/02/09 03:51:42 momjian Exp $
|
* $Id: relation.h,v 1.18 1999/02/10 03:52:50 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -148,7 +148,10 @@ typedef struct Path
|
|||||||
|
|
||||||
PathOrder *path_order;
|
PathOrder *path_order;
|
||||||
|
|
||||||
List *keys; /* this is a List of List of keys */
|
List *pathkeys; /* This is a List of List of Var nodes.
|
||||||
|
* It is a List of Lists because of multi-key
|
||||||
|
* indexes.
|
||||||
|
*/
|
||||||
Cost outerjoincost;
|
Cost outerjoincost;
|
||||||
Relid joinid;
|
Relid joinid;
|
||||||
List *loc_restrictinfo;
|
List *loc_restrictinfo;
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (c) 1994, Regents of the University of California
|
* Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* $Id: cost.h,v 1.12 1999/02/03 20:15:52 momjian Exp $
|
* $Id: cost.h,v 1.13 1999/02/10 03:52:53 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -34,7 +34,7 @@ extern Cost cost_seqscan(int relid, int relpages, int reltuples);
|
|||||||
extern Cost cost_index(Oid indexid, int expected_indexpages, Cost selec,
|
extern Cost cost_index(Oid indexid, int expected_indexpages, Cost selec,
|
||||||
int relpages, int reltuples, int indexpages,
|
int relpages, int reltuples, int indexpages,
|
||||||
int indextuples, bool is_injoin);
|
int indextuples, bool is_injoin);
|
||||||
extern Cost cost_sort(List *keys, int tuples, int width, bool noread);
|
extern Cost cost_sort(List *pathkeys, int tuples, int width, bool noread);
|
||||||
extern Cost cost_nestloop(Cost outercost, Cost innercost, int outertuples,
|
extern Cost cost_nestloop(Cost outercost, Cost innercost, int outertuples,
|
||||||
int innertuples, int outerpages, bool is_indexjoin);
|
int innertuples, int outerpages, bool is_indexjoin);
|
||||||
extern Cost cost_mergejoin(Cost outercost, Cost innercost,
|
extern Cost cost_mergejoin(Cost outercost, Cost innercost,
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (c) 1994, Regents of the University of California
|
* Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* $Id: pathnode.h,v 1.10 1998/09/01 04:37:13 momjian Exp $
|
* $Id: pathnode.h,v 1.11 1999/02/10 03:52:54 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -28,15 +28,15 @@ extern Path *create_seqscan_path(RelOptInfo * rel);
|
|||||||
extern IndexPath *create_index_path(Query *root, RelOptInfo * rel, RelOptInfo * index,
|
extern IndexPath *create_index_path(Query *root, RelOptInfo * rel, RelOptInfo * index,
|
||||||
List *restriction_clauses, bool is_join_scan);
|
List *restriction_clauses, bool is_join_scan);
|
||||||
extern JoinPath *create_nestloop_path(RelOptInfo * joinrel, RelOptInfo * outer_rel,
|
extern JoinPath *create_nestloop_path(RelOptInfo * joinrel, RelOptInfo * outer_rel,
|
||||||
Path *outer_path, Path *inner_path, List *keys);
|
Path *outer_path, Path *inner_path, List *pathkeys);
|
||||||
extern MergePath *create_mergejoin_path(RelOptInfo * joinrel, int outersize,
|
extern MergePath *create_mergejoin_path(RelOptInfo * joinrel, int outersize,
|
||||||
int innersize, int outerwidth, int innerwidth, Path *outer_path,
|
int innersize, int outerwidth, int innerwidth, Path *outer_path,
|
||||||
Path *inner_path, List *keys, MergeOrder *order,
|
Path *inner_path, List *pathkeys, MergeOrder *order,
|
||||||
List *mergeclauses, List *outersortkeys, List *innersortkeys);
|
List *mergeclauses, List *outersortkeys, List *innersortkeys);
|
||||||
|
|
||||||
extern HashPath *create_hashjoin_path(RelOptInfo * joinrel, int outersize,
|
extern HashPath *create_hashjoin_path(RelOptInfo * joinrel, int outersize,
|
||||||
int innersize, int outerwidth, int innerwidth, Path *outer_path,
|
int innersize, int outerwidth, int innerwidth, Path *outer_path,
|
||||||
Path *inner_path, List *keys, Oid operator, List *hashclauses,
|
Path *inner_path, List *pathkeys, Oid operator, List *hashclauses,
|
||||||
List *outerkeys, List *innerkeys);
|
List *outerkeys, List *innerkeys);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user