aboutsummaryrefslogtreecommitdiff
path: root/src/backend/optimizer/path/orindxpath.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2005-06-09 04:19:00 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2005-06-09 04:19:00 +0000
commita31ad27fc5dc32a1453233575b3cf7b5c34cf515 (patch)
tree6bff6baa96ebe794165a4939d234f3a54068e2c6 /src/backend/optimizer/path/orindxpath.c
parentc51815afed2bfac02fbc4afff891eb1224eb7eae (diff)
downloadpostgresql-a31ad27fc5dc32a1453233575b3cf7b5c34cf515.tar.gz
postgresql-a31ad27fc5dc32a1453233575b3cf7b5c34cf515.zip
Simplify the planner's join clause management by storing join clauses
of a relation in a flat 'joininfo' list. The former arrangement grouped the join clauses according to the set of unjoined relids used in each; however, profiling on test cases involving lots of joins proves that that data structure is a net loss. It takes more time to group the join clauses together than is saved by avoiding duplicate tests later. It doesn't help any that there are usually not more than one or two clauses per group ...
Diffstat (limited to 'src/backend/optimizer/path/orindxpath.c')
-rw-r--r--src/backend/optimizer/path/orindxpath.c58
1 files changed, 26 insertions, 32 deletions
diff --git a/src/backend/optimizer/path/orindxpath.c b/src/backend/optimizer/path/orindxpath.c
index 0e2eefc868c..7eadd220b94 100644
--- a/src/backend/optimizer/path/orindxpath.c
+++ b/src/backend/optimizer/path/orindxpath.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/path/orindxpath.c,v 1.71 2005/06/05 22:32:55 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/path/orindxpath.c,v 1.72 2005/06/09 04:18:59 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -96,43 +96,37 @@ create_or_index_quals(PlannerInfo *root, RelOptInfo *rel)
*/
foreach(i, rel->joininfo)
{
- JoinInfo *joininfo = (JoinInfo *) lfirst(i);
- ListCell *j;
+ RestrictInfo *rinfo = (RestrictInfo *) lfirst(i);
- foreach(j, joininfo->jinfo_restrictinfo)
+ if (restriction_is_or_clause(rinfo) &&
+ rinfo->valid_everywhere)
{
- RestrictInfo *rinfo = (RestrictInfo *) lfirst(j);
+ /*
+ * Use the generate_bitmap_or_paths() machinery to estimate
+ * the value of each OR clause. We can use regular
+ * restriction clauses along with the OR clause contents to
+ * generate indexquals. We pass outer_relids = NULL so that
+ * sub-clauses that are actually joins will be ignored.
+ */
+ List *orpaths;
+ ListCell *k;
- if (restriction_is_or_clause(rinfo) &&
- rinfo->valid_everywhere)
- {
- /*
- * Use the generate_bitmap_or_paths() machinery to estimate
- * the value of each OR clause. We can use regular
- * restriction clauses along with the OR clause contents to
- * generate indexquals. We pass outer_relids = NULL so that
- * sub-clauses that are actually joins will be ignored.
- */
- List *orpaths;
- ListCell *k;
+ orpaths = generate_bitmap_or_paths(root, rel,
+ list_make1(rinfo),
+ rel->baserestrictinfo,
+ false, NULL);
- orpaths = generate_bitmap_or_paths(root, rel,
- list_make1(rinfo),
- rel->baserestrictinfo,
- false, NULL);
+ /* Locate the cheapest OR path */
+ foreach(k, orpaths)
+ {
+ BitmapOrPath *path = (BitmapOrPath *) lfirst(k);
- /* Locate the cheapest OR path */
- foreach(k, orpaths)
+ Assert(IsA(path, BitmapOrPath));
+ if (bestpath == NULL ||
+ path->path.total_cost < bestpath->path.total_cost)
{
- BitmapOrPath *path = (BitmapOrPath *) lfirst(k);
-
- Assert(IsA(path, BitmapOrPath));
- if (bestpath == NULL ||
- path->path.total_cost < bestpath->path.total_cost)
- {
- bestpath = path;
- bestrinfo = rinfo;
- }
+ bestpath = path;
+ bestrinfo = rinfo;
}
}
}