summaryrefslogtreecommitdiff
path: root/src/backend/executor
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2002-11-30 05:21:03 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2002-11-30 05:21:03 +0000
commit935969415a90065d4bc4b2643b4c9c50518c934b (patch)
tree49488aee7f8c95a338e4b53024d4aaeb36d2abcc /src/backend/executor
parent829cedc8cf04801c8fce49afa5dd57b3833b969f (diff)
Be more realistic about plans involving Materialize nodes: take their
cost into account while planning.
Diffstat (limited to 'src/backend/executor')
-rw-r--r--src/backend/executor/execAmi.c60
-rw-r--r--src/backend/executor/nodeSeqscan.c7
-rw-r--r--src/backend/executor/nodeTidscan.c8
3 files changed, 47 insertions, 28 deletions
diff --git a/src/backend/executor/execAmi.c b/src/backend/executor/execAmi.c
index 7ceb7cd2c6f..1d7bf67f60b 100644
--- a/src/backend/executor/execAmi.c
+++ b/src/backend/executor/execAmi.c
@@ -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
- *
- * Marks the current scan position.
+/*
+ * 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.
- * ----------------------------------------------------------------
+ * 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
- *
- * restores the scan position previously saved with ExecMarkPos()
+/*
+ * ExecRestrPos
*
- * 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;
+}
diff --git a/src/backend/executor/nodeSeqscan.c b/src/backend/executor/nodeSeqscan.c
index 074a52731c0..b6848d6c4b3 100644
--- a/src/backend/executor/nodeSeqscan.c
+++ b/src/backend/executor/nodeSeqscan.c
@@ -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"
diff --git a/src/backend/executor/nodeTidscan.c b/src/backend/executor/nodeTidscan.c
index f5e477663b5..0fb7c6df4a8 100644
--- a/src/backend/executor/nodeTidscan.c
+++ b/src/backend/executor/nodeTidscan.c
@@ -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