mirror of
https://github.com/postgres/postgres.git
synced 2025-08-28 18:48:04 +03:00
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.
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/backend/optimizer/geqo/geqo_eval.c,v 1.90 2009/07/19 21:00:43 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/optimizer/geqo/geqo_eval.c,v 1.91 2009/11/28 00:46:18 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -88,9 +88,12 @@ geqo_eval(PlannerInfo *root, Gene *tour, int num_gene)
|
||||
* is one. We can do this by just temporarily setting the link to NULL.
|
||||
* (If we are dealing with enough join rels, which we very likely are, a
|
||||
* new hash table will get built and used locally.)
|
||||
*
|
||||
* join_rel_level[] shouldn't be in use, so just Assert it isn't.
|
||||
*/
|
||||
savelength = list_length(root->join_rel_list);
|
||||
savehash = root->join_rel_hash;
|
||||
Assert(root->join_rel_level == NULL);
|
||||
|
||||
root->join_rel_hash = NULL;
|
||||
|
||||
|
Reference in New Issue
Block a user