summaryrefslogtreecommitdiff
path: root/src/include/optimizer
diff options
context:
space:
mode:
authorTom Lane2006-01-31 21:39:25 +0000
committerTom Lane2006-01-31 21:39:25 +0000
commit8a1468af4e5c50dde8ce938886f4672459009b9b (patch)
treeeb9ae5decb8be1ebca8d124d947d0b7282802953 /src/include/optimizer
parent097df388b72584501762ac4c400dccff8a3671eb (diff)
Restructure planner's handling of inheritance. Rather than processing
inheritance trees on-the-fly, which pretty well constrained us to considering only one way of planning inheritance, expand inheritance sets during the planner prep phase, and build a side data structure that can be consulted later to find which RTEs are members of which inheritance sets. As proof of concept, use the data structure to plan joins against inheritance sets more efficiently: we can now use indexes on the set members in inner-indexscan joins. (The generated plans could be improved further, but it'll take some executor changes.) This data structure will also support handling UNION ALL subqueries in the same way as inheritance sets, but that aspect of it isn't finished yet.
Diffstat (limited to 'src/include/optimizer')
-rw-r--r--src/include/optimizer/pathnode.h6
-rw-r--r--src/include/optimizer/prep.h18
2 files changed, 16 insertions, 8 deletions
diff --git a/src/include/optimizer/pathnode.h b/src/include/optimizer/pathnode.h
index 6c8d62ac44f..84d9f865e37 100644
--- a/src/include/optimizer/pathnode.h
+++ b/src/include/optimizer/pathnode.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/optimizer/pathnode.h,v 1.63 2005/11/26 22:14:57 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/optimizer/pathnode.h,v 1.64 2006/01/31 21:39:25 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -85,8 +85,8 @@ extern HashPath *create_hashjoin_path(PlannerInfo *root,
/*
* prototypes for relnode.c
*/
-extern void build_base_rel(PlannerInfo *root, int relid);
-extern RelOptInfo *build_other_rel(PlannerInfo *root, int relid);
+extern RelOptInfo *build_simple_rel(PlannerInfo *root, int relid,
+ RelOptKind reloptkind);
extern RelOptInfo *find_base_rel(PlannerInfo *root, int relid);
extern RelOptInfo *find_join_rel(PlannerInfo *root, Relids relids);
extern RelOptInfo *build_join_rel(PlannerInfo *root,
diff --git a/src/include/optimizer/prep.h b/src/include/optimizer/prep.h
index ce89771b179..ca28cbc886f 100644
--- a/src/include/optimizer/prep.h
+++ b/src/include/optimizer/prep.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/optimizer/prep.h,v 1.53 2005/12/20 02:30:36 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/optimizer/prep.h,v 1.54 2006/01/31 21:39:25 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -46,10 +46,18 @@ extern Plan *plan_set_operations(PlannerInfo *root, double tuple_fraction,
extern List *find_all_inheritors(Oid parentrel);
-extern List *expand_inherited_rtentry(PlannerInfo *root, Index rti);
+extern void expand_inherited_tables(PlannerInfo *root);
-extern Node *adjust_inherited_attrs(Node *node,
- Index old_rt_index, Oid old_relid,
- Index new_rt_index, Oid new_relid);
+extern Node *adjust_appendrel_attrs(Node *node, AppendRelInfo *appinfo);
+
+extern Relids *adjust_appendrel_attr_needed(RelOptInfo *oldrel,
+ AppendRelInfo *appinfo,
+ AttrNumber new_min_attr,
+ AttrNumber new_max_attr);
+
+extern Relids *adjust_other_rel_attr_needed(RelOptInfo *oldrel,
+ AppendRelInfo *appinfo,
+ AttrNumber new_min_attr,
+ AttrNumber new_max_attr);
#endif /* PREP_H */