aboutsummaryrefslogtreecommitdiff
path: root/src/backend/optimizer/path/allpaths.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2006-09-19 22:49:53 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2006-09-19 22:49:53 +0000
commitb74c5436857cfd71a0f94736f19c9b070b053e24 (patch)
tree366bedff3f9e7c5735cd9b7635b2566ffc90f0a6 /src/backend/optimizer/path/allpaths.c
parent45e11d098f7b9c611c47e0f8565f4aa88281c914 (diff)
downloadpostgresql-b74c5436857cfd71a0f94736f19c9b070b053e24.tar.gz
postgresql-b74c5436857cfd71a0f94736f19c9b070b053e24.zip
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.
Diffstat (limited to 'src/backend/optimizer/path/allpaths.c')
-rw-r--r--src/backend/optimizer/path/allpaths.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/src/backend/optimizer/path/allpaths.c b/src/backend/optimizer/path/allpaths.c
index 794c14fbbab..0c2b6920cd1 100644
--- a/src/backend/optimizer/path/allpaths.c
+++ b/src/backend/optimizer/path/allpaths.c
@@ -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 $
*
*-------------------------------------------------------------------------
*/
@@ -280,13 +280,6 @@ set_append_rel_pathlist(PlannerInfo *root, RelOptInfo *rel,
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
*/
rel->rows = 0;
@@ -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