summaryrefslogtreecommitdiff
path: root/src/backend/optimizer/path/allpaths.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2004-01-05 05:07:36 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2004-01-05 05:07:36 +0000
commit9091e8d1b233faf9994518fda7fcc171fddb53ac (patch)
tree572b200768bbfba3cfc121f1b4c12c79ab650d96 /src/backend/optimizer/path/allpaths.c
parentbf488a6842ef2bf43ab89337c8970971e84951da (diff)
downloadpostgresql-9091e8d1b233faf9994518fda7fcc171fddb53ac.tar.gz
Add the ability to extract OR indexscan conditions from OR-of-AND
join conditions in which each OR subclause includes a constraint on the same relation. This implements the other useful side-effect of conversion to CNF format, without its unpleasant side-effects. As per pghackers discussion of a few weeks ago.
Diffstat (limited to 'src/backend/optimizer/path/allpaths.c')
-rw-r--r--src/backend/optimizer/path/allpaths.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/backend/optimizer/path/allpaths.c b/src/backend/optimizer/path/allpaths.c
index 1f979dd409..2d724265f0 100644
--- a/src/backend/optimizer/path/allpaths.c
+++ b/src/backend/optimizer/path/allpaths.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/path/allpaths.c,v 1.110 2003/12/17 17:07:48 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/path/allpaths.c,v 1.111 2004/01/05 05:07:35 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -151,6 +151,17 @@ set_plain_rel_pathlist(Query *root, RelOptInfo *rel, RangeTblEntry *rte)
/* Mark rel with estimated output rows, width, etc */
set_baserel_size_estimates(root, rel);
+ /* Test any partial indexes of rel for applicability */
+ check_partial_indexes(root, rel);
+
+ /*
+ * Check to see if we can extract any restriction conditions from
+ * join quals that are OR-of-AND structures. If so, add them to the
+ * rel's restriction list, and recompute the size estimates.
+ */
+ if (create_or_index_quals(root, rel))
+ set_baserel_size_estimates(root, rel);
+
/*
* Generate paths and add them to the rel's pathlist.
*
@@ -167,8 +178,6 @@ set_plain_rel_pathlist(Query *root, RelOptInfo *rel, RangeTblEntry *rte)
/* Consider index paths for both simple and OR index clauses */
create_index_paths(root, rel);
-
- /* create_index_paths must be done before create_or_index_paths */
create_or_index_paths(root, rel);
/* Now find the cheapest of the paths for this rel */