1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-27 12:41:57 +03:00

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.
This commit is contained in:
Tom Lane
2003-01-12 22:35:29 +00:00
parent d51260aa9d
commit d4ce5a4f4c
8 changed files with 164 additions and 71 deletions

View File

@ -1,5 +1,5 @@
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/Attic/indexcost.sgml,v 2.12 2002/08/22 00:01:40 tgl Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/Attic/indexcost.sgml,v 2.13 2003/01/12 22:35:29 tgl Exp $
-->
<chapter id="indexcost">
@ -237,9 +237,10 @@ amcostestimate (Query *root,
* Also, we charge for evaluation of the indexquals at each index tuple.
* All the costs are assumed to be paid incrementally during the scan.
*/
*indexStartupCost = 0;
cost_qual_eval(&index_qual_cost, indexQuals);
*indexStartupCost = index_qual_cost.startup;
*indexTotalCost = numIndexPages +
(cpu_index_tuple_cost + cost_qual_eval(indexQuals)) * numIndexTuples;
(cpu_index_tuple_cost + index_qual_cost.per_tuple) * numIndexTuples;
</programlisting>
</para>
</step>