- Notifications
You must be signed in to change notification settings - Fork5
Commit732bfa2
committed
Fix cost estimation for indexscan filter conditions.
cost_index's method for estimating per-tuple costs of evaluating filterconditions (a/k/a qpquals) was completely wrong in the presence of derivedindexable conditions, such as range conditions derived from a LIKE clause.This was largely masked in common cases as a result of all simple operatorclauses having about the same costs, but it could show up in a big way whendealing with functional indexes containing expensive functions, as seen forexample in bug #6579 from Istvan Endredy. Rejigger the calculation to givesane answers when the indexquals aren't a subset of the baserestrictinfolist. As a side benefit, we now do the calculation properly for casesinvolving join clauses (ie, parameterized indexscans), which we alwaysoverestimated before.There are still cases where this is an oversimplification, such as clausesthat can be dropped because they are implied by a partial index'spredicate. But we've never accounted for that in cost estimates before,and I'm not convinced it's worth the cycles to try to do so.1 parent880bfc3 commit732bfa2
1 file changed
+21
-19
lines changedLines changed: 21 additions & 19 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
228 | 228 |
| |
229 | 229 |
| |
230 | 230 |
| |
| 231 | + | |
231 | 232 |
| |
232 | 233 |
| |
233 | 234 |
| |
| |||
239 | 240 |
| |
240 | 241 |
| |
241 | 242 |
| |
| 243 | + | |
242 | 244 |
| |
243 | 245 |
| |
244 | 246 |
| |
| |||
267 | 269 |
| |
268 | 270 |
| |
269 | 271 |
| |
270 |
| - | |
271 |
| - | |
272 | 272 |
| |
273 | 273 |
| |
274 | 274 |
| |
| |||
283 | 283 |
| |
284 | 284 |
| |
285 | 285 |
| |
| 286 | + | |
| 287 | + | |
| 288 | + | |
286 | 289 |
| |
287 | 290 |
| |
288 | 291 |
| |
| |||
442 | 445 |
| |
443 | 446 |
| |
444 | 447 |
| |
445 |
| - | |
446 |
| - | |
447 |
| - | |
448 |
| - | |
449 |
| - | |
450 |
| - | |
451 |
| - | |
452 |
| - | |
453 |
| - | |
454 |
| - | |
455 |
| - | |
456 |
| - | |
457 |
| - | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
458 | 462 |
| |
459 |
| - | |
460 |
| - | |
461 |
| - | |
462 |
| - | |
| 463 | + | |
| 464 | + | |
463 | 465 |
| |
464 | 466 |
| |
465 | 467 |
| |
|
0 commit comments
Comments
(0)