1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-21 00:42:43 +03:00

First cut at unifying regular selectivity estimation with indexscan

selectivity estimation wasn't right.  This is better...
This commit is contained in:
Tom Lane
2000-01-23 02:07:00 +00:00
parent 49581f9848
commit 8449df8a67
5 changed files with 136 additions and 72 deletions

View File

@@ -18,7 +18,7 @@
* Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.48 2000/01/22 23:50:14 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.49 2000/01/23 02:06:59 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -459,7 +459,10 @@ set_rel_rows_width(Query *root, RelOptInfo *rel)
/* Should only be applied to base relations */
Assert(length(rel->relids) == 1);
rel->rows = rel->tuples * restrictlist_selec(root, rel->restrictinfo);
rel->rows = rel->tuples *
restrictlist_selectivity(root,
rel->restrictinfo,
lfirsti(rel->relids));
Assert(rel->rows >= 0);
set_rel_width(root, rel);
@@ -479,8 +482,10 @@ set_joinrel_rows_width(Query *root, RelOptInfo *rel,
temp = joinpath->outerjoinpath->parent->rows *
joinpath->innerjoinpath->parent->rows;
/* apply restrictivity */
temp *= restrictlist_selec(root, joinpath->path.parent->restrictinfo);
/* apply join restrictivity */
temp *= restrictlist_selectivity(root,
joinpath->path.parent->restrictinfo,
0);
Assert(temp >= 0);
rel->rows = temp;