- Notifications
You must be signed in to change notification settings - Fork5
Commitf3ff043
committed
In planner, don't assume that empty parent tables aren't really empty.
There's a heuristic in estimate_rel_size() to clamp the minimum sizeestimate for a table to 10 pages, unless we can see that vacuum or analyzehas been run (and set relpages to something nonzero, so this will alwayshappen for a table that's actually empty). However, it would be betternot to do this for inheritance parent tables, which very commonly arereally empty and can be expected to stay that way. Per discussion of arecent pgsql-performance report from Anish Kejariwal. Also prevent itfrom happening for indexes (although this is more in the nature ofdocumentation, since CREATE INDEX normally initializes relpages tosomething nonzero anyway).Back-patch to 9.0, because the ability to collect statistics across awhole inheritance tree has improved the planner's estimates to the pointwhere this relatively small error makes a significant difference. In thereferenced report, merge or hash joins were incorrectly estimated ascheaper than a nestloop with inner indexscan on the inherited table.That was less likely before 9.0 because the lack of inherited stats wouldhave resulted in a default (and rather pessimistic) estimate of the costof a merge or hash join.1 parentc529f88 commitf3ff043
1 file changed
+30
-14
lines changedLines changed: 30 additions & 14 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
385 | 385 |
| |
386 | 386 |
| |
387 | 387 |
| |
388 |
| - | |
389 |
| - | |
390 |
| - | |
391 |
| - | |
392 |
| - | |
393 |
| - | |
394 |
| - | |
395 |
| - | |
396 |
| - | |
397 |
| - | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
398 | 403 |
| |
399 | 404 |
| |
400 | 405 |
| |
401 | 406 |
| |
402 | 407 |
| |
403 | 408 |
| |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
404 | 415 |
| |
405 |
| - | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
406 | 420 |
| |
407 | 421 |
| |
408 | 422 |
| |
| |||
418 | 432 |
| |
419 | 433 |
| |
420 | 434 |
| |
421 |
| - | |
422 |
| - | |
423 |
| - | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
424 | 439 |
| |
425 | 440 |
| |
426 | 441 |
| |
427 | 442 |
| |
428 | 443 |
| |
429 | 444 |
| |
430 | 445 |
| |
| 446 | + | |
431 | 447 |
| |
432 | 448 |
| |
433 | 449 |
| |
|
0 commit comments
Comments
(0)