- Notifications
You must be signed in to change notification settings - Fork5
Commitb989619
committed
Fix cost estimation for indexscans on expensive indexed expressions.
genericcostestimate() and friends used the cost of the entire indexqualexpressions as the charge for initial evaluation of indexscan arguments.But of course the index column is not evaluated, only the other sideof the qual expression, so this was a bad overestimate if the indexcolumn was an expensive expression.To fix, refactor the logic in this area so that there's a single routinecharged with deconstructing index quals and figuring out what is the indexcolumn and what is the comparison expression. This is more or less free inthe case of btree indexes, since btcostestimate() was doing equivalentdeconstruction already. It probably adds a bit of new overhead in the casesof other index types, but not a lot. (In the case of GIN I think I savedsomething by getting rid of code that wasn't aware that the index columnassociations were already available "for free".)Per recent gripe from Jeff Janes.Arguably this is a bug fix, but I'm hesitant to back-patch because of thepossibility of destabilizing plan choices that people may be happy with.1 parentf8b031b commitb989619
1 file changed
+244
-147
lines changed0 commit comments
Comments
(0)