mirror of
https://github.com/postgres/postgres.git
synced 2025-07-14 08:21:07 +03:00
Improve usage of effective_cache_size parameter by assuming that all the
tables in the query compete for cache space, not just the one we are currently costing an indexscan for. This seems more realistic, and it definitely will help in examples recently exhibited by Stefan Kaltenbrunner. To get the total size of all the tables involved, we must tweak the handling of 'append relations' a bit --- formerly we looked up information about the child tables on-the-fly during set_append_rel_pathlist, but it needs to be done before we start doing any cost estimation, so push it into the add_base_rels_to_query scan.
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/optimizer/path/allpaths.c,v 1.152 2006/08/19 02:48:53 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/optimizer/path/allpaths.c,v 1.153 2006/09/19 22:49:52 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -279,13 +279,6 @@ set_append_rel_pathlist(PlannerInfo *root, RelOptInfo *rel,
|
||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
errmsg("SELECT FOR UPDATE/SHARE is not supported for inheritance queries")));
|
||||
|
||||
/*
|
||||
* We might have looked up indexes for the parent rel, but they're
|
||||
* really not relevant to the appendrel. Reset the pointer to avoid
|
||||
* any confusion.
|
||||
*/
|
||||
rel->indexlist = NIL;
|
||||
|
||||
/*
|
||||
* Initialize to compute size estimates for whole append relation
|
||||
*/
|
||||
@ -312,11 +305,11 @@ set_append_rel_pathlist(PlannerInfo *root, RelOptInfo *rel,
|
||||
childRTindex = appinfo->child_relid;
|
||||
|
||||
/*
|
||||
* Make a RelOptInfo for the child so we can do planning. Mark it as
|
||||
* an "other rel" since it will not be part of the main join tree.
|
||||
* The child rel's RelOptInfo was already created during
|
||||
* add_base_rels_to_query.
|
||||
*/
|
||||
childrel = build_simple_rel(root, childRTindex,
|
||||
RELOPT_OTHER_MEMBER_REL);
|
||||
childrel = find_base_rel(root, childRTindex);
|
||||
Assert(childrel->reloptkind == RELOPT_OTHER_MEMBER_REL);
|
||||
|
||||
/*
|
||||
* Copy the parent's targetlist and quals to the child, with
|
||||
|
Reference in New Issue
Block a user