diff options
author | Tom Lane | 2011-10-14 21:23:01 +0000 |
---|---|---|
committer | Tom Lane | 2011-10-14 21:23:46 +0000 |
commit | e6858e665731c0f56d3ecc9fbb245c32d24f8ef7 (patch) | |
tree | 4df2705d53d53b1bbd7a14d7017cb519d82ee227 /src/include/nodes/relation.h | |
parent | dea95c7a7beb5ef66ce89269dd0e84d0c26e5523 (diff) |
Measure the number of all-visible pages for use in index-only scan costing.
Add a column pg_class.relallvisible to remember the number of pages that
were all-visible according to the visibility map as of the last VACUUM
(or ANALYZE, or some other operations that update pg_class.relpages).
Use relallvisible/relpages, instead of an arbitrary constant, to estimate
how many heap page fetches can be avoided during an index-only scan.
This is pretty primitive and will no doubt see refinements once we've
acquired more field experience with the index-only scan mechanism, but
it's way better than using a constant.
Note: I had to adjust an underspecified query in the window.sql regression
test, because it was changing answers when the plan changed to use an
index-only scan. Some of the adjacent tests perhaps should be adjusted
as well, but I didn't do that here.
Diffstat (limited to 'src/include/nodes/relation.h')
-rw-r--r-- | src/include/nodes/relation.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/include/nodes/relation.h b/src/include/nodes/relation.h index 45ca52e516e..ef84e9f138d 100644 --- a/src/include/nodes/relation.h +++ b/src/include/nodes/relation.h @@ -319,6 +319,7 @@ typedef struct PlannerInfo * (always NIL if it's not a table) * pages - number of disk pages in relation (zero if not a table) * tuples - number of tuples in relation (not considering restrictions) + * allvisfrac - fraction of disk pages that are marked all-visible * subplan - plan for subquery (NULL if it's not a subquery) * subroot - PlannerInfo for subquery (NULL if it's not a subquery) * @@ -402,8 +403,9 @@ typedef struct RelOptInfo Relids *attr_needed; /* array indexed [min_attr .. max_attr] */ int32 *attr_widths; /* array indexed [min_attr .. max_attr] */ List *indexlist; /* list of IndexOptInfo */ - BlockNumber pages; + BlockNumber pages; /* size estimates derived from pg_class */ double tuples; + double allvisfrac; struct Plan *subplan; /* if subquery */ PlannerInfo *subroot; /* if subquery */ |