mirror of
https://github.com/postgres/postgres.git
synced 2025-07-14 08:21:07 +03:00
Instead of rechecking lossy index operators by putting them into the
regular qpqual ('filter condition'), add special-purpose code to nodeIndexscan.c to recheck them. This ends being almost no net addition of code, because the removal of planner code balances out the extra executor code, but it is significantly more efficient when a lossy operator is involved in an OR indexscan. The old implementation had to recheck the entire indexqual in such cases.
This commit is contained in:
@ -49,7 +49,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/optimizer/path/costsize.c,v 1.121 2004/01/05 23:39:54 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/optimizer/path/costsize.c,v 1.122 2004/01/06 04:31:01 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -384,10 +384,6 @@ cost_index(Path *path, Query *root,
|
||||
* some of the indexquals are join clauses and shouldn't be
|
||||
* subtracted. Rather than work out exactly how much to subtract, we
|
||||
* don't subtract anything.
|
||||
*
|
||||
* XXX For a lossy index, not all the quals will be removed and so we
|
||||
* really shouldn't subtract their costs; but detecting that seems
|
||||
* more expensive than it's worth.
|
||||
*/
|
||||
startup_cost += baserel->baserestrictcost.startup;
|
||||
cpu_per_tuple = cpu_tuple_cost + baserel->baserestrictcost.per_tuple;
|
||||
@ -397,6 +393,7 @@ cost_index(Path *path, Query *root,
|
||||
QualCost index_qual_cost;
|
||||
|
||||
cost_qual_eval(&index_qual_cost, indexQuals);
|
||||
/* any startup cost still has to be paid ... */
|
||||
cpu_per_tuple -= index_qual_cost.per_tuple;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user