forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit4d41799
committed
Add eager and lazy freezing strategies to VACUUM.
Eager freezing strategy avoids large build-ups of all-visible pages. Itmakes VACUUM trigger page-level freezing whenever doing so will enablethe page to become all-frozen in the visibility map. This is useful fortables that experience continual growth, particularly strict append-onlytables such as pgbench's history table. Eager freezing significantlyimproves performance stability by spreading out the cost of freezingover time, rather than doing most freezing during aggressive VACUUMs.It complements the insert autovacuum mechanism added by commitb07642d.VACUUM determines its freezing strategy based on the value of the newvacuum_freeze_strategy_threshold GUC (or reloption) with logged tables.Tables that exceed the size threshold use the eager freezing strategy.Unlogged tables and temp tables always use eager freezing strategy,since the added cost is negligible there. Non-permanent relations won'tincur any extra overhead in WAL written (for the obvious reason), nor inpages dirtied (since any extra freezing will only take place on pageswhose PD_ALL_VISIBLE bit needed to be set either way).VACUUM uses lazy freezing strategy for logged tables that fall under theGUC size threshold. Page-level freezing triggers based on the criteriaestablished in commit1de58df, which added basic page-level freezing.Eager freezing is strictly more aggressive than lazy freezing. Settingslike vacuum_freeze_min_age still get applied in just the same way inevery VACUUM, independent of the strategy in use. The only mechanicaldifference between eager and lazy freezing strategies is that only theformer applies its own additional criteria to trigger freezing pages.Note that even lazy freezing strategy will trigger freezing whenever apage happens to have required that an FPI be written during pruning,provided that the page will thereby become all-frozen in the visibilitymap afterwards (due to the FPI optimization from commit1de58df).The vacuum_freeze_strategy_threshold default setting is 4GB. This is arelatively low setting that prioritizes performance stability. It willbe reviewed at the end of the Postgres 16 beta period.Author: Peter Geoghegan <pg@bowt.ie>Reviewed-By: Jeff Davis <pgsql@j-davis.com>Reviewed-By: Andres Freund <andres@anarazel.de>Reviewed-By: Matthias van de Meent <boekewurm+postgres@gmail.com>Discussion:https://postgr.es/m/CAH2-WzkFok_6EAHuK39GaW4FjEFQsY=3J0AAd6FXk93u-Xq3Fg@mail.gmail.com1 parent642e882 commit4d41799
File tree
12 files changed
+197
-14
lines changed- doc/src/sgml
- ref
- src
- backend
- access
- common
- heap
- commands
- postmaster
- utils/misc
- include
- commands
- utils
12 files changed
+197
-14
lines changedLines changed: 30 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
9272 | 9272 |
| |
9273 | 9273 |
| |
9274 | 9274 |
| |
| 9275 | + | |
| 9276 | + | |
| 9277 | + | |
| 9278 | + | |
| 9279 | + | |
| 9280 | + | |
| 9281 | + | |
| 9282 | + | |
| 9283 | + | |
| 9284 | + | |
| 9285 | + | |
| 9286 | + | |
| 9287 | + | |
| 9288 | + | |
| 9289 | + | |
| 9290 | + | |
| 9291 | + | |
| 9292 | + | |
| 9293 | + | |
| 9294 | + | |
| 9295 | + | |
| 9296 | + | |
| 9297 | + | |
| 9298 | + | |
| 9299 | + | |
| 9300 | + | |
| 9301 | + | |
| 9302 | + | |
| 9303 | + | |
| 9304 | + | |
9275 | 9305 |
| |
9276 | 9306 |
| |
9277 | 9307 |
| |
|
Lines changed: 38 additions & 12 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
478 | 478 |
| |
479 | 479 |
| |
480 | 480 |
| |
481 |
| - | |
482 |
| - | |
483 |
| - | |
484 |
| - | |
485 |
| - | |
486 |
| - | |
487 |
| - | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
488 | 505 |
| |
489 | 506 |
| |
490 | 507 |
| |
| |||
506 | 523 |
| |
507 | 524 |
| |
508 | 525 |
| |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
509 | 535 |
| |
510 | 536 |
| |
511 | 537 |
| |
512 | 538 |
| |
513 |
| - | |
514 |
| - | |
| 539 | + | |
| 540 | + | |
515 | 541 |
| |
516 | 542 |
| |
517 | 543 |
| |
| |||
551 | 577 |
| |
552 | 578 |
| |
553 | 579 |
| |
554 |
| - | |
| 580 | + | |
555 | 581 |
| |
556 | 582 |
| |
557 | 583 |
| |
| |||
837 | 863 |
| |
838 | 864 |
| |
839 | 865 |
| |
840 |
| - | |
841 |
| - | |
| 866 | + | |
| 867 | + | |
842 | 868 |
| |
843 | 869 |
| |
844 | 870 |
| |
|
Lines changed: 14 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1781 | 1781 |
| |
1782 | 1782 |
| |
1783 | 1783 |
| |
| 1784 | + | |
| 1785 | + | |
| 1786 | + | |
| 1787 | + | |
| 1788 | + | |
| 1789 | + | |
| 1790 | + | |
| 1791 | + | |
| 1792 | + | |
| 1793 | + | |
| 1794 | + | |
| 1795 | + | |
| 1796 | + | |
| 1797 | + | |
1784 | 1798 |
| |
1785 | 1799 |
| |
1786 | 1800 |
| |
|
Lines changed: 10 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
312 | 312 |
| |
313 | 313 |
| |
314 | 314 |
| |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
315 | 323 |
| |
316 | 324 |
| |
317 | 325 |
| |
| |||
1863 | 1871 |
| |
1864 | 1872 |
| |
1865 | 1873 |
| |
| 1874 | + | |
| 1875 | + | |
1866 | 1876 |
| |
1867 | 1877 |
| |
1868 | 1878 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
7057 | 7057 |
| |
7058 | 7058 |
| |
7059 | 7059 |
| |
| 7060 | + | |
7060 | 7061 |
| |
7061 | 7062 |
| |
7062 | 7063 |
| |
|
Lines changed: 42 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
153 | 153 |
| |
154 | 154 |
| |
155 | 155 |
| |
| 156 | + | |
| 157 | + | |
156 | 158 |
| |
157 | 159 |
| |
158 | 160 |
| |
| |||
243 | 245 |
| |
244 | 246 |
| |
245 | 247 |
| |
| 248 | + | |
246 | 249 |
| |
247 | 250 |
| |
248 | 251 |
| |
| |||
472 | 475 |
| |
473 | 476 |
| |
474 | 477 |
| |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
475 | 482 |
| |
476 | 483 |
| |
477 | 484 |
| |
| |||
1267 | 1274 |
| |
1268 | 1275 |
| |
1269 | 1276 |
| |
| 1277 | + | |
| 1278 | + | |
| 1279 | + | |
| 1280 | + | |
| 1281 | + | |
| 1282 | + | |
| 1283 | + | |
| 1284 | + | |
| 1285 | + | |
| 1286 | + | |
| 1287 | + | |
| 1288 | + | |
| 1289 | + | |
| 1290 | + | |
| 1291 | + | |
| 1292 | + | |
| 1293 | + | |
| 1294 | + | |
| 1295 | + | |
| 1296 | + | |
| 1297 | + | |
| 1298 | + | |
| 1299 | + | |
| 1300 | + | |
| 1301 | + | |
| 1302 | + | |
| 1303 | + | |
| 1304 | + | |
| 1305 | + | |
| 1306 | + | |
| 1307 | + | |
| 1308 | + | |
1270 | 1309 |
| |
1271 | 1310 |
| |
1272 | 1311 |
| |
| |||
1795 | 1834 |
| |
1796 | 1835 |
| |
1797 | 1836 |
| |
| 1837 | + | |
| 1838 | + | |
1798 | 1839 |
| |
1799 | 1840 |
| |
1800 | 1841 |
| |
1801 |
| - | |
| 1842 | + | |
1802 | 1843 |
| |
1803 | 1844 |
| |
1804 | 1845 |
| |
|
Lines changed: 24 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
68 | 68 |
| |
69 | 69 |
| |
70 | 70 |
| |
| 71 | + | |
71 | 72 |
| |
72 | 73 |
| |
73 | 74 |
| |
| |||
264 | 265 |
| |
265 | 266 |
| |
266 | 267 |
| |
| 268 | + | |
267 | 269 |
| |
268 | 270 |
| |
269 | 271 |
| |
270 | 272 |
| |
271 | 273 |
| |
272 | 274 |
| |
273 | 275 |
| |
| 276 | + | |
274 | 277 |
| |
275 | 278 |
| |
276 | 279 |
| |
| |||
962 | 965 |
| |
963 | 966 |
| |
964 | 967 |
| |
965 |
| - | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
966 | 971 |
| |
967 | 972 |
| |
968 | 973 |
| |
| |||
975 | 980 |
| |
976 | 981 |
| |
977 | 982 |
| |
| 983 | + | |
978 | 984 |
| |
979 | 985 |
| |
980 | 986 |
| |
| |||
1089 | 1095 |
| |
1090 | 1096 |
| |
1091 | 1097 |
| |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
1092 | 1115 |
| |
1093 | 1116 |
| |
1094 | 1117 |
| |
|
Lines changed: 10 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
151 | 151 |
| |
152 | 152 |
| |
153 | 153 |
| |
| 154 | + | |
154 | 155 |
| |
155 | 156 |
| |
156 | 157 |
| |
| |||
2010 | 2011 |
| |
2011 | 2012 |
| |
2012 | 2013 |
| |
| 2014 | + | |
2013 | 2015 |
| |
2014 | 2016 |
| |
2015 | 2017 |
| |
2016 | 2018 |
| |
2017 | 2019 |
| |
2018 | 2020 |
| |
2019 | 2021 |
| |
| 2022 | + | |
2020 | 2023 |
| |
2021 | 2024 |
| |
2022 | 2025 |
| |
| |||
2801 | 2804 |
| |
2802 | 2805 |
| |
2803 | 2806 |
| |
| 2807 | + | |
2804 | 2808 |
| |
2805 | 2809 |
| |
2806 | 2810 |
| |
| |||
2850 | 2854 |
| |
2851 | 2855 |
| |
2852 | 2856 |
| |
| 2857 | + | |
| 2858 | + | |
| 2859 | + | |
| 2860 | + | |
| 2861 | + | |
2853 | 2862 |
| |
2854 | 2863 |
| |
2855 | 2864 |
| |
| |||
2877 | 2886 |
| |
2878 | 2887 |
| |
2879 | 2888 |
| |
| 2889 | + | |
2880 | 2890 |
| |
2881 | 2891 |
| |
2882 | 2892 |
| |
|
Lines changed: 14 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2535 | 2535 |
| |
2536 | 2536 |
| |
2537 | 2537 |
| |
| 2538 | + | |
| 2539 | + | |
| 2540 | + | |
| 2541 | + | |
| 2542 | + | |
| 2543 | + | |
| 2544 | + | |
| 2545 | + | |
| 2546 | + | |
| 2547 | + | |
| 2548 | + | |
| 2549 | + | |
| 2550 | + | |
| 2551 | + | |
2538 | 2552 |
| |
2539 | 2553 |
| |
2540 | 2554 |
| |
|
0 commit comments
Comments
(0)