diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2003-01-12 22:35:29 +0000 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2003-01-12 22:35:29 +0000 |
| commit | d4ce5a4f4c3516e88fa34c53bcc7313db90a3c08 (patch) | |
| tree | 4c6b53e1c1e0989a9f45fe42ab6f29ffac019c03 /src/include | |
| parent | d51260aa9d36653f4d63e6df133ddff8380f61b2 (diff) | |
Revise cost_qual_eval() to compute both startup (one-time) and per-tuple
costs for expression evaluation, not only per-tuple cost as before.
This extension is needed in order to deal realistically with hashed or
materialized sub-selects.
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/nodes/relation.h | 16 | ||||
| -rw-r--r-- | src/include/optimizer/cost.h | 4 |
2 files changed, 15 insertions, 5 deletions
diff --git a/src/include/nodes/relation.h b/src/include/nodes/relation.h index 6da47683e6e..d3fb2231f1e 100644 --- a/src/include/nodes/relation.h +++ b/src/include/nodes/relation.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: relation.h,v 1.74 2002/12/12 15:49:40 tgl Exp $ + * $Id: relation.h,v 1.75 2003/01/12 22:35:29 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -35,6 +35,16 @@ typedef enum CostSelector STARTUP_COST, TOTAL_COST } CostSelector; +/* + * The cost estimate produced by cost_qual_eval() includes both a one-time + * (startup) cost, and a per-tuple cost. + */ +typedef struct QualCost +{ + Cost startup; /* one-time cost */ + Cost per_tuple; /* per-evaluation cost */ +} QualCost; + /*---------- * RelOptInfo * Per-relation information for planning/optimization @@ -199,7 +209,7 @@ typedef struct RelOptInfo /* used by various scans and joins: */ List *baserestrictinfo; /* RestrictInfo structures (if * base rel) */ - Cost baserestrictcost; /* cost of evaluating the above */ + QualCost baserestrictcost; /* cost of evaluating the above */ Relids outerjoinset; /* integer list of base relids */ List *joininfo; /* JoinInfo structures */ @@ -570,7 +580,7 @@ typedef struct RestrictInfo /* subclauseindices is a List of Lists of IndexOptInfos */ /* cache space for costs (currently only used for join clauses) */ - Cost eval_cost; /* eval cost of clause; -1 if not yet set */ + QualCost eval_cost; /* eval cost of clause; -1 if not yet set */ Selectivity this_selec; /* selectivity; -1 if not yet set */ /* valid if clause is mergejoinable, else InvalidOid: */ diff --git a/src/include/optimizer/cost.h b/src/include/optimizer/cost.h index 5bb5092571b..b5fef65c5dc 100644 --- a/src/include/optimizer/cost.h +++ b/src/include/optimizer/cost.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: cost.h,v 1.49 2002/11/30 05:21:03 tgl Exp $ + * $Id: cost.h,v 1.50 2003/01/12 22:35:29 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -83,7 +83,7 @@ extern void cost_hashjoin(Path *path, Query *root, Path *outer_path, Path *inner_path, List *restrictlist, List *hashclauses); -extern Cost cost_qual_eval(List *quals); +extern void cost_qual_eval(QualCost *cost, List *quals); extern void set_baserel_size_estimates(Query *root, RelOptInfo *rel); extern void set_joinrel_size_estimates(Query *root, RelOptInfo *rel, RelOptInfo *outer_rel, |
