forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit052026c
committed
Eagerly scan all-visible pages to amortize aggressive vacuum
Aggressive vacuums must scan every unfrozen tuple in order to advancethe relfrozenxid/relminmxid. Because data is often vacuumed before it isold enough to require freezing, relations may build up a large backlogof pages that are set all-visible but not all-frozen in the visibilitymap. When an aggressive vacuum is triggered, all of these pages must bescanned. These pages have often been evicted from shared buffers andeven from the kernel buffer cache. Thus, aggressive vacuums often incurlarge amounts of extra I/O at the expense of foreground workloads.To amortize the cost of aggressive vacuums, eagerly scan someall-visible but not all-frozen pages during normal vacuums.All-visible pages that are eagerly scanned and set all-frozen in thevisibility map are counted as successful eager freezes and those notfrozen are counted as failed eager freezes.If too many eager scans fail in a row, eager scanning is temporarilysuspended until a later portion of the relation. The number of failurestolerated is configurable globally and per table.To effectively amortize aggressive vacuums, we cap the number ofsuccesses as well. Capping eager freeze successes also limits the amountof potentially wasted work if these pages are modified again before thenext aggressive vacuum. Once we reach the maximum number of blockssuccessfully eager frozen, eager scanning is disabled for the remainderof the vacuum of the relation.Original design idea from Robert Haas, with enhancements fromAndres Freund, Tomas Vondra, and meReviewed-by: Robert Haas <robertmhaas@gmail.com>Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>Reviewed-by: Andres Freund <andres@anarazel.de>Reviewed-by: Robert Treat <rob@xzilla.net>Reviewed-by: Bilal Yavuz <byavuz81@gmail.com>Discussion:https://postgr.es/m/flat/CAAKRu_ZF_KCzZuOrPrOqjGVe8iRVWEAJSpzMgRQs%3D5-v84cXUg%40mail.gmail.com1 parent4dd09a1 commit052026c
File tree
12 files changed
+552
-41
lines changed- doc/src/sgml
- ref
- src
- backend
- access
- common
- heap
- commands
- postmaster
- utils/misc
- bin/psql
- include
- commands
- utils
12 files changed
+552
-41
lines changedLines changed: 39 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
9147 | 9147 |
| |
9148 | 9148 |
| |
9149 | 9149 |
| |
| 9150 | + | |
| 9151 | + | |
| 9152 | + | |
| 9153 | + | |
| 9154 | + | |
| 9155 | + | |
| 9156 | + | |
| 9157 | + | |
| 9158 | + | |
| 9159 | + | |
| 9160 | + | |
| 9161 | + | |
| 9162 | + | |
| 9163 | + | |
| 9164 | + | |
| 9165 | + | |
| 9166 | + | |
| 9167 | + | |
| 9168 | + | |
| 9169 | + | |
| 9170 | + | |
| 9171 | + | |
| 9172 | + | |
| 9173 | + | |
| 9174 | + | |
| 9175 | + | |
| 9176 | + | |
| 9177 | + | |
| 9178 | + | |
| 9179 | + | |
| 9180 | + | |
| 9181 | + | |
| 9182 | + | |
| 9183 | + | |
| 9184 | + | |
| 9185 | + | |
| 9186 | + | |
| 9187 | + | |
| 9188 | + | |
9150 | 9189 |
| |
9151 | 9190 |
| |
9152 | 9191 |
| |
|
Lines changed: 25 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
496 | 496 |
| |
497 | 497 |
| |
498 | 498 |
| |
499 |
| - | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
500 | 516 |
| |
501 |
| - | |
| 517 | + | |
502 | 518 |
| |
503 | 519 |
| |
504 | 520 |
| |
| |||
626 | 642 |
| |
627 | 643 |
| |
628 | 644 |
| |
629 |
| - | |
630 |
| - | |
631 |
| - | |
632 |
| - | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
633 | 651 |
| |
634 | 652 |
| |
635 | 653 |
| |
| |||
931 | 949 |
| |
932 | 950 |
| |
933 | 951 |
| |
934 |
| - | |
935 |
| - | |
| 952 | + | |
936 | 953 |
| |
937 | 954 |
| |
938 | 955 |
| |
|
Lines changed: 15 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1950 | 1950 |
| |
1951 | 1951 |
| |
1952 | 1952 |
| |
| 1953 | + | |
| 1954 | + | |
| 1955 | + | |
| 1956 | + | |
| 1957 | + | |
| 1958 | + | |
| 1959 | + | |
| 1960 | + | |
| 1961 | + | |
| 1962 | + | |
| 1963 | + | |
| 1964 | + | |
| 1965 | + | |
| 1966 | + | |
| 1967 | + | |
1953 | 1968 |
| |
1954 | 1969 |
| |
1955 | 1970 |
| |
|
Lines changed: 13 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
432 | 432 |
| |
433 | 433 |
| |
434 | 434 |
| |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
435 | 445 |
| |
436 | 446 |
| |
437 | 447 |
| |
| |||
1891 | 1901 |
| |
1892 | 1902 |
| |
1893 | 1903 |
| |
1894 |
| - | |
| 1904 | + | |
| 1905 | + | |
| 1906 | + | |
1895 | 1907 |
| |
1896 | 1908 |
| |
1897 | 1909 |
| |
|
0 commit comments
Comments
(0)