forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit667e65a
committed
Use TidStore for dead tuple TIDs storage during lazy vacuum.
Previously, we used a simple array for storing dead tuple IDs duringlazy vacuum, which had a number of problems:* The array used a single allocation and so was limited to 1GB.* The allocation was pessimistically sized according to table size.* Lookup with binary search was slow because of poor CPU cache and branch prediction behavior.This commit replaces that array with the TID store from commit30e1442.Since the backing radix tree makes small allocations as needed, the1GB limit is now gone. Further, the total memory used is now oftensmaller by an order of magnitude or more, depending on thedistribution of blocks and offsets. These two features should makemultiple rounds of heap scanning and index cleanup an extremely rareevent. TID lookup during index cleanup is also several times faster,even more so when index order is correlated with heap tuple order.Since there is no longer a predictable relationship between the numberof dead tuples vacuumed and the space taken up by their TIDs, thenumber of tuples no longer provides any meaningful insights for users,nor is the maximum number predictable. For that reason this commitalso changes to byte-based progress reporting, with the relevantcolumns of pg_stat_progress_vacuum renamed accordingly tomax_dead_tuple_bytes and dead_tuple_bytes.For parallel vacuum, both the TID store and supplemental informationspecific to vacuum are shared among the parallel vacuum workers. Aswith the previous array, we don't take any locks on TidStore duringparallel vacuum since writes are still only done by the leaderprocess.Bump catalog version.Reviewed-by: John Naylor, (in an earlier version) Dilip KumarDiscussion:https://postgr.es/m/CAD21AoAfOZvmfR0j8VmZorZjL7RhTiQdVttNuC4W-Shdc2a-AA%40mail.gmail.com1 parentd5d2205 commit667e65a
File tree
14 files changed
+226
-289
lines changed- doc/src/sgml
- src
- backend
- access/heap
- catalog
- commands
- storage/lmgr
- utils/activity
- include
- catalog
- commands
- storage
- test/regress/expected
- tools/pgindent
14 files changed
+226
-289
lines changedLines changed: 0 additions & 12 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1919 | 1919 |
| |
1920 | 1920 |
| |
1921 | 1921 |
| |
1922 |
| - | |
1923 |
| - | |
1924 |
| - | |
1925 |
| - | |
1926 |
| - | |
1927 | 1922 |
| |
1928 | 1923 |
| |
1929 | 1924 |
| |
| |||
1946 | 1941 |
| |
1947 | 1942 |
| |
1948 | 1943 |
| |
1949 |
| - | |
1950 |
| - | |
1951 |
| - | |
1952 |
| - | |
1953 |
| - | |
1954 |
| - | |
1955 |
| - | |
1956 | 1944 |
| |
1957 | 1945 |
| |
1958 | 1946 |
| |
|
Lines changed: 4 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
6237 | 6237 |
| |
6238 | 6238 |
| |
6239 | 6239 |
| |
6240 |
| - | |
| 6240 | + | |
6241 | 6241 |
| |
6242 | 6242 |
| |
6243 |
| - | |
| 6243 | + | |
6244 | 6244 |
| |
6245 | 6245 |
| |
6246 | 6246 |
| |
6247 | 6247 |
| |
6248 | 6248 |
| |
6249 | 6249 |
| |
6250 | 6250 |
| |
6251 |
| - | |
| 6251 | + | |
6252 | 6252 |
| |
6253 | 6253 |
| |
6254 |
| - | |
| 6254 | + | |
6255 | 6255 |
| |
6256 | 6256 |
| |
6257 | 6257 |
| |
|
0 commit comments
Comments
(0)