diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2004-01-05 23:39:54 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2004-01-05 23:39:54 +0000 |
commit | fa559a86eec2ae90fd63fd7e6563e42f7dc619e0 (patch) | |
tree | a43de4df13060be5df59c38d7b3b9a5e47069e05 /src/backend/optimizer/util/pathnode.c | |
parent | 5d472f64647346a44af6ab2ab9ca70cadf9fe788 (diff) | |
download | postgresql-fa559a86eec2ae90fd63fd7e6563e42f7dc619e0.tar.gz postgresql-fa559a86eec2ae90fd63fd7e6563e42f7dc619e0.zip |
Adjust indexscan planning logic to keep RestrictInfo nodes associated
with index qual clauses in the Path representation. This saves a little
work during createplan and (probably more importantly) allows reuse of
cached selectivity estimates during indexscan planning. Also fix latent
bug: wrong plan would have been generated for a 'special operator' used
in a nestloop-inner-indexscan join qual, because the special operator
would not have gotten into the list of quals to recheck. This bug is
only latent because at present the special-operator code could never
trigger on a join qual, but sooner or later someone will want to do it.
Diffstat (limited to 'src/backend/optimizer/util/pathnode.c')
-rw-r--r-- | src/backend/optimizer/util/pathnode.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/backend/optimizer/util/pathnode.c b/src/backend/optimizer/util/pathnode.c index a2a6b35cd32..5fe12f2b6d5 100644 --- a/src/backend/optimizer/util/pathnode.c +++ b/src/backend/optimizer/util/pathnode.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/optimizer/util/pathnode.c,v 1.98 2004/01/05 18:04:39 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/util/pathnode.c,v 1.99 2004/01/05 23:39:54 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -354,18 +354,22 @@ create_index_path(Query *root, pathnode->path.parent = rel; pathnode->path.pathkeys = pathkeys; - /* Convert RestrictInfo nodes to indexquals the executor can handle */ + /* Convert clauses to indexquals the executor can handle */ indexquals = expand_indexqual_conditions(index, restriction_clauses); + /* Flatten the clause-groups list to produce indexclauses list */ + restriction_clauses = flatten_clausegroups_list(restriction_clauses); + /* * We are making a pathnode for a single-scan indexscan; therefore, - * both indexinfo and indexqual should be single-element lists. + * indexinfo etc should be single-element lists. */ pathnode->indexinfo = makeList1(index); - pathnode->indexqual = makeList1(indexquals); + pathnode->indexclauses = makeList1(restriction_clauses); + pathnode->indexquals = makeList1(indexquals); /* It's not an innerjoin path. */ - pathnode->indexjoinclauses = NIL; + pathnode->isjoininner = false; pathnode->indexscandir = indexscandir; |