1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-26 01:22:12 +03:00

Tid access method feature from Hiroshi Inoue, Inoue@tpf.co.jp

This commit is contained in:
Bruce Momjian
1999-11-23 20:07:06 +00:00
parent 54ffd4677a
commit 6f9ff92cc0
28 changed files with 1396 additions and 32 deletions

View File

@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.96 1999/11/15 03:28:06 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.97 1999/11/23 20:06:52 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -253,6 +253,32 @@ _copyIndexScan(IndexScan *from)
return newnode;
}
/* ----------------
* _copyTidScan
* ----------------
*/
static TidScan *
_copyTidScan(TidScan *from)
{
TidScan *newnode = makeNode(TidScan);
/* ----------------
* copy node superclass fields
* ----------------
*/
CopyPlanFields((Plan *) from, (Plan *) newnode);
CopyScanFields((Scan *) from, (Scan *) newnode);
/* ----------------
* copy remainder of node
* ----------------
*/
newnode->needRescan = from->needRescan;
Node_Copy(from, newnode, tideval);
return newnode;
}
/* ----------------
* CopyJoinFields
*
@ -1058,6 +1084,30 @@ _copyIndexPath(IndexPath *from)
return newnode;
}
/* ----------------
* _copyTidPath
* ----------------
*/
static TidPath *
_copyTidPath(TidPath *from)
{
TidPath *newnode = makeNode(TidPath);
/* ----------------
* copy the node superclass fields
* ----------------
*/
CopyPathFields((Path *) from, (Path *) newnode);
/* ----------------
* copy remainder of node
* ----------------
*/
Node_Copy(from, newnode, tideval);
newnode->unjoined_relids = listCopy(from->unjoined_relids);
return newnode;
}
/* ----------------
* CopyJoinPathFields
*
@ -1437,6 +1487,9 @@ copyObject(void *from)
case T_IndexScan:
retval = _copyIndexScan(from);
break;
case T_TidScan:
retval = _copyTidScan(from);
break;
case T_Join:
retval = _copyJoin(from);
break;
@ -1535,6 +1588,9 @@ copyObject(void *from)
case T_IndexPath:
retval = _copyIndexPath(from);
break;
case T_TidPath:
retval = _copyTidPath(from);
break;
case T_NestPath:
retval = _copyNestPath(from);
break;

View File

@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.51 1999/11/15 03:28:06 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.52 1999/11/23 20:06:52 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -330,6 +330,18 @@ _equalIndexPath(IndexPath *a, IndexPath *b)
return true;
}
static bool
_equalTidPath(TidPath *a, TidPath *b)
{
if (!_equalPath((Path *) a, (Path *) b))
return false;
if (!equal(a->tideval, b->tideval))
return false;
if (!equali(a->unjoined_relids, b->unjoined_relids))
return false;
return true;
}
static bool
_equalJoinPath(JoinPath *a, JoinPath *b)
{
@ -403,6 +415,28 @@ _equalIndexScan(IndexScan *a, IndexScan *b)
return true;
}
static bool
_equalTidScan(TidScan *a, TidScan *b)
{
Assert(IsA(a, TidScan));
Assert(IsA(b, TidScan));
/*
* if(a->scan.plan.cost != b->scan.plan.cost) return(false);
*/
if (a->needRescan != b->needRescan)
return false;
if (!equal(a->tideval, b->tideval))
return false;
if (a->scan.scanrelid != b->scan.scanrelid)
return false;
return true;
}
static bool
_equalSubPlan(SubPlan *a, SubPlan *b)
{
@ -756,6 +790,9 @@ equal(void *a, void *b)
case T_IndexPath:
retval = _equalIndexPath(a, b);
break;
case T_TidPath:
retval = _equalTidPath(a, b);
break;
case T_NestPath:
retval = _equalNestPath(a, b);
break;
@ -768,6 +805,9 @@ equal(void *a, void *b)
case T_IndexScan:
retval = _equalIndexScan(a, b);
break;
case T_TidScan:
retval = _equalTidScan(a, b);
break;
case T_SubPlan:
retval = _equalSubPlan(a, b);
break;

View File

@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/Attic/freefuncs.c,v 1.27 1999/11/15 03:28:07 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/Attic/freefuncs.c,v 1.28 1999/11/23 20:06:53 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -183,6 +183,29 @@ _freeIndexScan(IndexScan *node)
pfree(node);
}
/* ----------------
* _freeTidScan
* ----------------
*/
static void
_freeTidScan(TidScan *node)
{
/* ----------------
* free node superclass fields
* ----------------
*/
FreePlanFields((Plan *) node);
FreeScanFields((Scan *) node);
/* ----------------
* free remainder of node
* ----------------
*/
freeObject(node->tideval);
pfree(node);
}
/* ----------------
* FreeJoinFields
*
@ -781,6 +804,29 @@ _freeIndexPath(IndexPath *node)
pfree(node);
}
/* ----------------
* _freeTidPath
* ----------------
*/
static void
_freeTidPath(TidPath *node)
{
/* ----------------
* free the node superclass fields
* ----------------
*/
FreePathFields((Path *) node);
/* ----------------
* free remainder of node
* ----------------
*/
freeObject(node->tideval);
freeList(node->unjoined_relids);
pfree(node);
}
/* ----------------
* FreeJoinPathFields
*
@ -1079,6 +1125,9 @@ freeObject(void *node)
case T_IndexScan:
_freeIndexScan(node);
break;
case T_TidScan:
_freeTidScan(node);
break;
case T_Join:
_freeJoin(node);
break;
@ -1177,6 +1226,9 @@ freeObject(void *node)
case T_IndexPath:
_freeIndexPath(node);
break;
case T_TidPath:
_freeTidPath(node);
break;
case T_NestPath:
_freeNestPath(node);
break;

View File

@ -5,7 +5,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: outfuncs.c,v 1.97 1999/10/07 04:23:04 tgl Exp $
* $Id: outfuncs.c,v 1.98 1999/11/23 20:06:53 momjian Exp $
*
* NOTES
* Every (plan) node in POSTGRES has an associated "out" routine which
@ -451,6 +451,23 @@ _outIndexScan(StringInfo str, IndexScan *node)
appendStringInfo(str, " :indxorderdir %d ", node->indxorderdir);
}
/*
* TidScan is a subclass of Scan
*/
static void
_outTidScan(StringInfo str, TidScan *node)
{
appendStringInfo(str, " TIDSCAN ");
_outPlanInfo(str, (Plan *) node);
appendStringInfo(str, " :scanrelid %u ", node->scan.scanrelid);
appendStringInfo(str, " :needrescan %d ", node->needRescan);
appendStringInfo(str, " :tideval ");
_outNode(str, node->tideval);
}
/*
* Noname is a subclass of Plan
*/
@ -914,6 +931,25 @@ _outIndexPath(StringInfo str, IndexPath *node)
_outIntList(str, node->joinrelids);
}
/*
* TidPath is a subclass of Path.
*/
static void
_outTidPath(StringInfo str, TidPath *node)
{
appendStringInfo(str,
" TIDPATH :pathtype %d :cost %f :pathkeys ",
node->path.pathtype,
node->path.path_cost);
_outNode(str, node->path.pathkeys);
appendStringInfo(str, " :tideval ");
_outNode(str, node->tideval);
appendStringInfo(str, " :un joined_relids ");
_outIntList(str, node->unjoined_relids);
}
/*
* NestPath is a subclass of Path
*/
@ -1357,6 +1393,9 @@ _outNode(StringInfo str, void *obj)
case T_IndexScan:
_outIndexScan(str, obj);
break;
case T_TidScan:
_outTidScan(str, obj);
break;
case T_Noname:
_outNoname(str, obj);
break;
@ -1435,6 +1474,9 @@ _outNode(StringInfo str, void *obj)
case T_IndexPath:
_outIndexPath(str, obj);
break;
case T_TidPath:
_outTidPath(str, obj);
break;
case T_NestPath:
_outNestPath(str, obj);
break;

View File

@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/print.c,v 1.32 1999/08/16 02:17:43 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/print.c,v 1.33 1999/11/23 20:06:53 momjian Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
@ -338,6 +338,9 @@ plannode_type(Plan *p)
case T_Group:
return "GROUP";
break;
case T_TidScan:
return "TIDSCAN";
break;
default:
return "UNKNOWN";
break;

View File

@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.74 1999/10/07 04:23:04 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.75 1999/11/23 20:06:53 momjian Exp $
*
* NOTES
* Most of the read functions for plan nodes are tested. (In fact, they
@ -541,6 +541,33 @@ _readIndexScan()
return local_node;
}
/* ----------------
* _readTidScan
*
* TidScan is a subclass of Scan
* ----------------
*/
static TidScan *
_readTidScan()
{
TidScan *local_node;
char *token;
int length;
local_node = makeNode(TidScan);
_getScan((Scan *) local_node);
token = lsptok(NULL, &length); /* eat :needrescan */
token = lsptok(NULL, &length); /* get needrescan */
local_node->needRescan = atoi(token);
token = lsptok(NULL, &length); /* eat :tideval */
local_node->tideval = nodeRead(true); /* now read it */
return local_node;
}
/* ----------------
* _readNoname
*
@ -1476,6 +1503,41 @@ _readIndexPath()
return local_node;
}
/* ----------------
* _readTidPath
*
* TidPath is a subclass of Path.
* ----------------
*/
static TidPath *
_readTidPath()
{
TidPath *local_node;
char *token;
int length;
local_node = makeNode(TidPath);
token = lsptok(NULL, &length); /* get :pathtype */
token = lsptok(NULL, &length); /* now read it */
local_node->path.pathtype = atol(token);
token = lsptok(NULL, &length); /* get :cost */
token = lsptok(NULL, &length); /* now read it */
local_node->path.path_cost = (Cost) atof(token);
token = lsptok(NULL, &length); /* get :pathkeys */
local_node->path.pathkeys = nodeRead(true); /* now read it */
token = lsptok(NULL, &length); /* get :tideval */
local_node->tideval = nodeRead(true); /* now read it */
token = lsptok(NULL, &length); /* get :unjoined_relids */
local_node->unjoined_relids = toIntList(nodeRead(true));
return local_node;
}
/* ----------------
* _readNestPath
*
@ -1801,6 +1863,8 @@ parsePlanString(void)
return_value = _readSeqScan();
else if (!strncmp(token, "INDEXSCAN", length))
return_value = _readIndexScan();
else if (!strncmp(token, "TIDSCAN", length))
return_value = _readTidScan();
else if (!strncmp(token, "NONAME", length))
return_value = _readNoname();
else if (!strncmp(token, "SORT", length))
@ -1845,6 +1909,8 @@ parsePlanString(void)
return_value = _readPath();
else if (!strncmp(token, "INDEXPATH", length))
return_value = _readIndexPath();
else if (!strncmp(token, "TIDPATH", length))
return_value = _readTidPath();
else if (!strncmp(token, "NESTPATH", length))
return_value = _readNestPath();
else if (!strncmp(token, "MERGEPATH", length))