aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/spi.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2004-06-11 01:09:22 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2004-06-11 01:09:22 +0000
commit7643bed58ecc87eedf7da1ed1938e85ed770d2f8 (patch)
tree0d97a4c6cb2d02ba9f9d9b5b5d4e1a6d9cbd538e /src/backend/executor/spi.c
parent5fe8c7d6e50e3a310498f333e4f5130659c931fb (diff)
downloadpostgresql-7643bed58ecc87eedf7da1ed1938e85ed770d2f8.tar.gz
postgresql-7643bed58ecc87eedf7da1ed1938e85ed770d2f8.zip
When using extended-query protocol, postpone planning of unnamed statements
until Bind is received, so that actual parameter values are visible to the planner. Make use of the parameter values for estimation purposes (but don't fold them into the actual plan). This buys back most of the potential loss of plan quality that ensues from using out-of-line parameters instead of putting literal values right into the query text. This patch creates a notion of constant-folding expressions 'for estimation purposes only', in which case we can be more aggressive than the normal eval_const_expressions() logic can be. Right now the only difference in behavior is inserting bound values for Params, but it will be interesting to look at other possibilities. One that we've seen come up repeatedly is reducing now() and related functions to current values, so that queries like ... WHERE timestampcol > now() - '1 day' have some chance of being planned effectively. Oliver Jowett, with some kibitzing from Tom Lane.
Diffstat (limited to 'src/backend/executor/spi.c')
-rw-r--r--src/backend/executor/spi.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/backend/executor/spi.c b/src/backend/executor/spi.c
index f5f2850b982..91b633d9bd8 100644
--- a/src/backend/executor/spi.c
+++ b/src/backend/executor/spi.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/executor/spi.c,v 1.117 2004/06/06 00:41:26 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/spi.c,v 1.118 2004/06/11 01:08:43 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1125,7 +1125,7 @@ _SPI_execute(const char *src, int tcount, _SPI_plan *plan)
QueryDesc *qdesc;
DestReceiver *dest;
- planTree = pg_plan_query(queryTree);
+ planTree = pg_plan_query(queryTree, NULL);
plan_list = lappend(plan_list, planTree);
dest = CreateDestReceiver(queryTree->canSetTag ? SPI : None, NULL);