From 8b109ebf14cf449d36f293a4cb8188360fd5aec6 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Fri, 3 Feb 2006 21:08:49 +0000 Subject: Teach planner to convert simple UNION ALL subqueries into append relations, thereby sharing code with the inheritance case. This puts the UNION-ALL-view approach to partitioned tables on par with inheritance, so far as constraint exclusion is concerned: it works either way. (Still need to update the docs to say so.) The definition of "simple UNION ALL" is a little simpler than I would like --- basically the union arms can only be SELECT * FROM foo --- but it's good enough for partitioned-table cases. --- src/include/optimizer/pathnode.h | 9 ++++++++- src/include/optimizer/prep.h | 9 ++------- src/include/optimizer/tlist.h | 4 +++- 3 files changed, 13 insertions(+), 9 deletions(-) (limited to 'src/include/optimizer') diff --git a/src/include/optimizer/pathnode.h b/src/include/optimizer/pathnode.h index 84d9f865e3..3ba612c195 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.64 2006/01/31 21:39:25 tgl Exp $ + * $PostgreSQL: pgsql/src/include/optimizer/pathnode.h,v 1.65 2006/02/03 21:08:49 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -95,5 +95,12 @@ extern RelOptInfo *build_join_rel(PlannerInfo *root, RelOptInfo *inner_rel, JoinType jointype, List **restrictlist_ptr); +extern RelOptInfo *translate_join_rel(PlannerInfo *root, + RelOptInfo *oldjoinrel, + AppendRelInfo *appinfo, + RelOptInfo *outer_rel, + RelOptInfo *inner_rel, + JoinType jointype, + List **restrictlist_ptr); #endif /* PATHNODE_H */ diff --git a/src/include/optimizer/prep.h b/src/include/optimizer/prep.h index ca28cbc886..23b07006ee 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.54 2006/01/31 21:39:25 tgl Exp $ + * $PostgreSQL: pgsql/src/include/optimizer/prep.h,v 1.55 2006/02/03 21:08:49 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -23,7 +23,7 @@ */ extern Node *pull_up_IN_clauses(PlannerInfo *root, Node *node); extern Node *pull_up_subqueries(PlannerInfo *root, Node *jtnode, - bool below_outer_join); + bool below_outer_join, bool append_rel_member); extern void reduce_outer_joins(PlannerInfo *root); extern Relids get_relids_in_jointree(Node *jtnode); extern Relids get_relids_for_join(PlannerInfo *root, int joinrelid); @@ -55,9 +55,4 @@ extern Relids *adjust_appendrel_attr_needed(RelOptInfo *oldrel, 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 */ diff --git a/src/include/optimizer/tlist.h b/src/include/optimizer/tlist.h index 91418033ae..a282244f96 100644 --- a/src/include/optimizer/tlist.h +++ b/src/include/optimizer/tlist.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/tlist.h,v 1.42 2005/04/06 16:34:07 tgl Exp $ + * $PostgreSQL: pgsql/src/include/optimizer/tlist.h,v 1.43 2006/02/03 21:08:49 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -29,4 +29,6 @@ extern Node *get_sortgroupclause_expr(SortClause *sortClause, extern List *get_sortgrouplist_exprs(List *sortClauses, List *targetList); +extern bool tlist_same_datatypes(List *tlist, List *colTypes, bool junkOK); + #endif /* TLIST_H */ -- cgit v1.2.1