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

Be more realistic about plans involving Materialize nodes: take their

cost into account while planning.
This commit is contained in:
Tom Lane
2002-11-30 05:21:03 +00:00
parent 829cedc8cf
commit 935969415a
19 changed files with 320 additions and 160 deletions

View File

@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: execAmi.c,v 1.64 2002/06/20 20:29:27 momjian Exp $
* $Id: execAmi.c,v 1.65 2002/11/30 05:21:01 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -170,14 +170,10 @@ ExecReScan(Plan *node, ExprContext *exprCtxt, Plan *parent)
}
}
/* ----------------------------------------------------------------
* ExecMarkPos
/*
* ExecMarkPos
*
* Marks the current scan position.
*
* XXX Needs to be extended to include all the node types,
* or at least all the ones that can be directly below a mergejoin.
* ----------------------------------------------------------------
* Marks the current scan position.
*/
void
ExecMarkPos(Plan *node)
@ -192,6 +188,10 @@ ExecMarkPos(Plan *node)
ExecIndexMarkPos((IndexScan *) node);
break;
case T_TidScan:
ExecTidMarkPos((TidScan *) node);
break;
case T_FunctionScan:
ExecFunctionMarkPos((FunctionScan *) node);
break;
@ -204,10 +204,6 @@ ExecMarkPos(Plan *node)
ExecSortMarkPos((Sort *) node);
break;
case T_TidScan:
ExecTidMarkPos((TidScan *) node);
break;
default:
/* don't make hard error unless caller asks to restore... */
elog(LOG, "ExecMarkPos: node type %d not supported",
@ -216,14 +212,10 @@ ExecMarkPos(Plan *node)
}
}
/* ----------------------------------------------------------------
* ExecRestrPos
/*
* ExecRestrPos
*
* restores the scan position previously saved with ExecMarkPos()
*
* XXX Needs to be extended to include all the node types,
* or at least all the ones that can be directly below a mergejoin.
* ----------------------------------------------------------------
* restores the scan position previously saved with ExecMarkPos()
*/
void
ExecRestrPos(Plan *node)
@ -238,6 +230,10 @@ ExecRestrPos(Plan *node)
ExecIndexRestrPos((IndexScan *) node);
break;
case T_TidScan:
ExecTidRestrPos((TidScan *) node);
break;
case T_FunctionScan:
ExecFunctionRestrPos((FunctionScan *) node);
break;
@ -256,3 +252,29 @@ ExecRestrPos(Plan *node)
break;
}
}
/*
* ExecSupportsMarkRestore - does a plan type support mark/restore?
*
* XXX Ideally, all plan node types would support mark/restore, and this
* wouldn't be needed. For now, this had better match the routines above.
*/
bool
ExecSupportsMarkRestore(NodeTag plantype)
{
switch (plantype)
{
case T_SeqScan:
case T_IndexScan:
case T_TidScan:
case T_FunctionScan:
case T_Material:
case T_Sort:
return true;
default:
break;
}
return false;
}

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/nodeSeqscan.c,v 1.37 2002/09/04 20:31:18 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/nodeSeqscan.c,v 1.38 2002/11/30 05:21:01 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -19,9 +19,8 @@
* ExecInitSeqScan creates and initializes a seqscan node.
* ExecEndSeqScan releases any storage allocated.
* ExecSeqReScan rescans the relation
* ExecMarkPos marks scan position
* ExecRestrPos restores scan position
*
* ExecSeqMarkPos marks scan position
* ExecSeqRestrPos restores scan position
*/
#include "postgres.h"

View File

@ -8,19 +8,19 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/nodeTidscan.c,v 1.26 2002/09/04 20:31:18 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/nodeTidscan.c,v 1.27 2002/11/30 05:21:01 tgl Exp $
*
*-------------------------------------------------------------------------
*/
/*
* INTERFACE ROUTINES
*
* ExecTidScan scans a relation using tids
* ExecTidScan scans a relation using tids
* ExecInitTidScan creates and initializes state info.
* ExecTidReScan rescans the tid relation.
* ExecEndTidScan releases all storage.
* ExecTidMarkPos marks scan position.
*
* ExecTidRestrPos restores scan position.
*/
#include "postgres.h"
@ -345,7 +345,6 @@ ExecTidMarkPos(TidScan *node)
tidstate->tss_MarkTidPtr = tidstate->tss_TidPtr;
}
#ifdef NOT_USED
/* ----------------------------------------------------------------
* ExecTidRestrPos
*
@ -363,7 +362,6 @@ ExecTidRestrPos(TidScan *node)
tidstate = node->tidstate;
tidstate->tss_TidPtr = tidstate->tss_MarkTidPtr;
}
#endif
/* ----------------------------------------------------------------
* ExecInitTidScan