1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-16 06:01:02 +03:00

Further tweaking of indexscan cost estimates.

This commit is contained in:
Tom Lane
2000-04-09 04:31:37 +00:00
parent 5db0ef84e6
commit 9c38a8d296
2 changed files with 18 additions and 6 deletions

View File

@ -15,7 +15,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.62 2000/03/30 00:53:30 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.63 2000/04/09 04:31:37 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -902,10 +902,19 @@ genericcostestimate(Query *root, RelOptInfo *rel,
lfirsti(rel->relids));
/* Estimate the number of index tuples that will be visited */
numIndexTuples = ceil(*indexSelectivity * index->tuples);
numIndexTuples = *indexSelectivity * index->tuples;
/* Estimate the number of index pages that will be retrieved */
numIndexPages = ceil(*indexSelectivity * index->pages);
numIndexPages = *indexSelectivity * index->pages;
/*
* Always estimate at least one tuple and page are touched,
* even when indexSelectivity estimate is tiny.
*/
if (numIndexTuples < 1.0)
numIndexTuples = 1.0;
if (numIndexPages < 1.0)
numIndexPages = 1.0;
/*
* Compute the index access cost.