forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit587b6aa
committed
Correct relation size estimate with low fillfactor
Since commit29cf61a, table_block_relation_estimate_size() considersfillfactor when estimating number of rows in a relation before the firstANALYZE. The formula however did not consider tuples may be larger thanavailable space determined by fillfactor, ending with density 0. Thisultimately means the relation was estimated to contain a single row.The executor however places at least one tuple per page, even with verylow fillfactor values, so the density should be at least 1. Fixed byclamping the density estimate using clamp_row_est().Reported by Heikki Linnakangas. Fix by me, with regression test inspiredby example provided by Heikki.Backpatch to 17, where the issue was introduced.Reported-by: Heikki LinnakangasBackpatch-through: 17Discussion:https://postgr.es/m/2bf9d973-7789-4937-a7ca-0af9fb49c71e@iki.fi1 parent788baa9 commit587b6aa
3 files changed
+36
-0
lines changedLines changed: 3 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
24 | 24 |
| |
25 | 25 |
| |
26 | 26 |
| |
| 27 | + | |
27 | 28 |
| |
28 | 29 |
| |
29 | 30 |
| |
| |||
740 | 741 |
| |
741 | 742 |
| |
742 | 743 |
| |
| 744 | + | |
| 745 | + | |
743 | 746 |
| |
744 | 747 |
| |
745 | 748 |
| |
|
Lines changed: 17 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1646 | 1646 |
| |
1647 | 1647 |
| |
1648 | 1648 |
| |
| 1649 | + | |
| 1650 | + | |
| 1651 | + | |
| 1652 | + | |
| 1653 | + | |
| 1654 | + | |
| 1655 | + | |
| 1656 | + | |
| 1657 | + | |
| 1658 | + | |
| 1659 | + | |
| 1660 | + | |
| 1661 | + | |
| 1662 | + | |
| 1663 | + | |
| 1664 | + | |
| 1665 | + | |
1649 | 1666 |
|
Lines changed: 16 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
849 | 849 |
| |
850 | 850 |
| |
851 | 851 |
| |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
852 | 868 |
|
0 commit comments
Comments
(0)