mirror of
https://github.com/postgres/postgres.git
synced 2025-07-02 09:02:37 +03:00
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.
This commit is contained in:
@ -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;
|
||||
|
||||
|
Reference in New Issue
Block a user