summaryrefslogtreecommitdiff
path: root/src/include/nodes/relation.h
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2009-11-28 00:46:19 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2009-11-28 00:46:19 +0000
commit1a95f12702b4e535b5e26ed9c3fcd0b2a1b1a20f (patch)
treec56c54fce5968c874b21fb902c1090b486da4719 /src/include/nodes/relation.h
parentfe83b975b2bdfa9b553872aa9a5dc959ca89a51f (diff)
downloadpostgresql-1a95f12702b4e535b5e26ed9c3fcd0b2a1b1a20f.tar.gz
Eliminate a lot of list-management overhead within join_search_one_level
by adding a requirement that build_join_rel add new join RelOptInfos to the appropriate list immediately at creation. Per report from Robert Haas, the list_concat_unique_ptr() calls that this change eliminates were taking the lion's share of the runtime in larger join problems. This doesn't do anything to fix the fundamental combinatorial explosion in large join problems, but it should push out the threshold of pain a bit further. Note: because this changes the order in which joinrel lists are built, it might result in changes in selected plans in cases where different alternatives have exactly the same costs. There is one example in the regression tests.
Diffstat (limited to 'src/include/nodes/relation.h')
-rw-r--r--src/include/nodes/relation.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/include/nodes/relation.h b/src/include/nodes/relation.h
index d54770eabc..8738a9924d 100644
--- a/src/include/nodes/relation.h
+++ b/src/include/nodes/relation.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/nodes/relation.h,v 1.179 2009/11/15 02:45:35 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/nodes/relation.h,v 1.180 2009/11/28 00:46:19 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -142,6 +142,16 @@ typedef struct PlannerInfo
List *join_rel_list; /* list of join-relation RelOptInfos */
struct HTAB *join_rel_hash; /* optional hashtable for join relations */
+ /*
+ * When doing a dynamic-programming-style join search, join_rel_level[k]
+ * is a list of all join-relation RelOptInfos of level k, and
+ * join_cur_level is the current level. New join-relation RelOptInfos
+ * are automatically added to the join_rel_level[join_cur_level] list.
+ * join_rel_level is NULL if not in use.
+ */
+ List **join_rel_level; /* lists of join-relation RelOptInfos */
+ int join_cur_level; /* index of list being extended */
+
List *resultRelations; /* integer list of RT indexes, or NIL */
List *init_plans; /* init SubPlans for query */