aboutsummaryrefslogtreecommitdiff
path: root/src/backend/optimizer/path/costsize.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2000-03-30 00:53:30 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2000-03-30 00:53:30 +0000
commite55985d3be4aed47c703674c735c124ff0b3c03c (patch)
tree4be5accd90a1c1561737d9297ab0df7eec74118c /src/backend/optimizer/path/costsize.c
parent341dc91820b3f80ae69a51f2780fd0d8afcb2c47 (diff)
downloadpostgresql-e55985d3be4aed47c703674c735c124ff0b3c03c.tar.gz
postgresql-e55985d3be4aed47c703674c735c124ff0b3c03c.zip
Tweak indexscan cost estimation: round estimated # of tuples visited up
to next integer. Previously, if selectivity was small, we could compute very tiny scan cost on the basis of estimating that only 0.001 tuple would be fetched, which is silly. This naturally led to some rather silly plans...
Diffstat (limited to 'src/backend/optimizer/path/costsize.c')
-rw-r--r--src/backend/optimizer/path/costsize.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/backend/optimizer/path/costsize.c b/src/backend/optimizer/path/costsize.c
index 4270032d278..37b4dfc42e7 100644
--- a/src/backend/optimizer/path/costsize.c
+++ b/src/backend/optimizer/path/costsize.c
@@ -42,7 +42,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.54 2000/03/22 22:08:33 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.55 2000/03/30 00:53:29 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -262,11 +262,11 @@ cost_index(Path *path, Query *root,
* effect. Would be nice to do better someday.
*/
- tuples_fetched = indexSelectivity * baserel->tuples;
+ tuples_fetched = ceil(indexSelectivity * baserel->tuples);
if (tuples_fetched > 0 && baserel->pages > 0)
- pages_fetched = baserel->pages *
- log(tuples_fetched / baserel->pages + 1.0);
+ pages_fetched = ceil(baserel->pages *
+ log(tuples_fetched / baserel->pages + 1.0));
else
pages_fetched = tuples_fetched;
@@ -594,7 +594,7 @@ cost_hashjoin(Path *path,
* conservatively as the inner disbursion times the inner tuple count.
*/
run_cost += cpu_operator_cost * outer_path->parent->rows *
- (inner_path->parent->rows * innerdisbursion);
+ ceil(inner_path->parent->rows * innerdisbursion);
/*
* Estimate the number of tuples that get through the hashing filter