aboutsummaryrefslogtreecommitdiff
path: root/src/backend/optimizer/util/pathnode.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>1999-07-30 04:07:25 +0000
committerTom Lane <tgl@sss.pgh.pa.us>1999-07-30 04:07:25 +0000
commit04578a91800751ddac902be592dec35d9fb6daf1 (patch)
treefc671926d4ea6d6e56984ea07cff4ee81a2e586b /src/backend/optimizer/util/pathnode.c
parent037cac7ca644f4a90f12c5e4715b4c51a8268cb3 (diff)
downloadpostgresql-04578a91800751ddac902be592dec35d9fb6daf1.tar.gz
postgresql-04578a91800751ddac902be592dec35d9fb6daf1.zip
Further cleanups of indexqual processing: simplify control
logic in indxpath.c, avoid generation of redundant indexscan paths for the same relation and index.
Diffstat (limited to 'src/backend/optimizer/util/pathnode.c')
-rw-r--r--src/backend/optimizer/util/pathnode.c30
1 files changed, 9 insertions, 21 deletions
diff --git a/src/backend/optimizer/util/pathnode.c b/src/backend/optimizer/util/pathnode.c
index de5f2fda5b2..0edb1801498 100644
--- a/src/backend/optimizer/util/pathnode.c
+++ b/src/backend/optimizer/util/pathnode.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/util/pathnode.c,v 1.50 1999/07/30 00:56:17 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/pathnode.c,v 1.51 1999/07/30 04:07:25 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -300,23 +300,20 @@ create_seqscan_path(RelOptInfo *rel)
/*
* create_index_path
- * Creates a single path node for an index scan.
+ * Creates a path node for an index scan.
*
* 'rel' is the parent rel
- * 'index' is the pathnode for the index on 'rel'
- * 'restriction_clauses' is a list of restriction clause nodes.
- * 'is_join_scan' is a flag indicating whether or not the index is being
- * considered because of its sort order.
+ * 'index' is an index on 'rel'
+ * 'restriction_clauses' is a list of RestrictInfo nodes
+ * to be used as index qual conditions in the scan.
*
* Returns the new path node.
- *
*/
IndexPath *
create_index_path(Query *root,
RelOptInfo *rel,
RelOptInfo *index,
- List *restriction_clauses,
- bool is_join_scan)
+ List *restriction_clauses)
{
IndexPath *pathnode = makeNode(IndexPath);
@@ -361,20 +358,11 @@ create_index_path(Query *root,
else
pathnode->path.pathkeys = NULL;
- if (is_join_scan || restriction_clauses == NULL)
+ if (restriction_clauses == NIL)
{
/*
- * Indices used for joins or sorting result nodes don't restrict
- * the result at all, they simply order it, so compute the scan
- * cost accordingly -- use a selectivity of 1.0.
- *
- * is the statement above really true? what about IndexScan as the
- * inner of a join?
- *
- * I think it's OK --- this routine is only used to make index paths
- * for mergejoins and sorts. Index paths used as the inner side of
- * a nestloop join do provide restriction, but they are not made
- * with this code. See index_innerjoin() in indxpath.c.
+ * We have no restriction clauses, so compute scan cost using
+ * selectivity of 1.0.
*/
pathnode->path.path_cost = cost_index(lfirsti(index->relids),
index->pages,