aboutsummaryrefslogtreecommitdiff
path: root/src/backend/nodes/print.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2000-02-15 20:49:31 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2000-02-15 20:49:31 +0000
commitb1577a7c78d2d8880b3c0f94689fb75bd074c897 (patch)
treec8d8f0500eb2eaa085d921a46a7d0987ba594a4a /src/backend/nodes/print.c
parent553b5da6a1147881dc1df101ecf9bab75f767ccf (diff)
downloadpostgresql-b1577a7c78d2d8880b3c0f94689fb75bd074c897.tar.gz
postgresql-b1577a7c78d2d8880b3c0f94689fb75bd074c897.zip
New cost model for planning, incorporating a penalty for random page
accesses versus sequential accesses, a (very crude) estimate of the effects of caching on random page accesses, and cost to evaluate WHERE- clause expressions. Export critical parameters for this model as SET variables. Also, create SET variables for the planner's enable flags (enable_seqscan, enable_indexscan, etc) so that these can be controlled more conveniently than via PGOPTIONS. Planner now estimates both startup cost (cost before retrieving first tuple) and total cost of each path, so it can optimize queries with LIMIT on a reasonable basis by interpolating between these costs. Same facility is a win for EXISTS(...) subqueries and some other cases. Redesign pathkey representation to achieve a major speedup in planning (I saw as much as 5X on a 10-way join); also minor changes in planner to reduce memory consumption by recycling discarded Path nodes and not constructing unnecessary lists. Minor cleanups to display more-plausible costs in some cases in EXPLAIN output. Initdb forced by change in interface to index cost estimation functions.
Diffstat (limited to 'src/backend/nodes/print.c')
-rw-r--r--src/backend/nodes/print.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/backend/nodes/print.c b/src/backend/nodes/print.c
index a84b829950f..248991c0928 100644
--- a/src/backend/nodes/print.c
+++ b/src/backend/nodes/print.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/nodes/print.c,v 1.36 2000/02/15 03:37:09 thomas Exp $
+ * $Header: /cvsroot/pgsql/src/backend/nodes/print.c,v 1.37 2000/02/15 20:49:12 tgl Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
@@ -175,9 +175,8 @@ print_expr(Node *expr, List *rtable)
{
rt = rt_fetch(var->varno, rtable);
relname = rt->relname;
- if (rt->ref)
- if (rt->ref->relname)
- relname = rt->relname; /* table renamed */
+ if (rt->ref && rt->ref->relname)
+ relname = rt->ref->relname; /* table renamed */
attname = get_attname(rt->relid, var->varattno);
}
break;
@@ -366,8 +365,9 @@ print_plan_recursive(Plan *p, Query *parsetree, int indentLevel, char *label)
return;
for (i = 0; i < indentLevel; i++)
printf(" ");
- printf("%s%s :c=%.4f :r=%.0f :w=%d ", label, plannode_type(p),
- p->cost, p->plan_rows, p->plan_width);
+ printf("%s%s :c=%.2f..%.2f :r=%.0f :w=%d ", label, plannode_type(p),
+ p->startup_cost, p->total_cost,
+ p->plan_rows, p->plan_width);
if (IsA(p, Scan) ||IsA(p, SeqScan))
{
RangeTblEntry *rte;