Commit 6dbb490
committed
Combine freezing and pruning steps in VACUUM
Execute both freezing and pruning of tuples in the same
heap_page_prune() function, now called heap_page_prune_and_freeze(),
and emit a single WAL record containing all changes. That reduces the
overall amount of WAL generated.
This moves the freezing logic from vacuumlazy.c to the
heap_page_prune_and_freeze() function. The main difference in the
coding is that in vacuumlazy.c, we looked at the tuples after the
pruning had already happened, but in heap_page_prune_and_freeze() we
operate on the tuples before pruning. The heap_prepare_freeze_tuple()
function is now invoked after we have determined that a tuple is not
going to be pruned away.
VACUUM no longer needs to loop through the items on the page after
pruning. heap_page_prune_and_freeze() does all the work. It now
returns the list of dead offsets, including existing LP_DEAD items, to
the caller. Similarly it's now responsible for tracking 'all_visible',
'all_frozen', and 'hastup' on the caller's behalf.
Author: Melanie Plageman <melanieplageman@gmail.com>
Discussion: https://www.postgresql.org/message-id/20240330055710.kqg6ii2cdojsxgje@liskov1 parent 26d138f commit 6dbb490
File tree
7 files changed
+813
-545
lines changed- src
- backend
- access/heap
- storage/ipc
- include/access
- tools/pgindent
7 files changed
+813
-545
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6447 | 6447 | | |
6448 | 6448 | | |
6449 | 6449 | | |
6450 | | - | |
6451 | | - | |
6452 | | - | |
| 6450 | + | |
| 6451 | + | |
| 6452 | + | |
6453 | 6453 | | |
6454 | 6454 | | |
6455 | 6455 | | |
| |||
6765 | 6765 | | |
6766 | 6766 | | |
6767 | 6767 | | |
6768 | | - | |
6769 | | - | |
6770 | | - | |
6771 | | - | |
6772 | | - | |
6773 | | - | |
6774 | | - | |
6775 | | - | |
6776 | | - | |
6777 | | - | |
6778 | | - | |
6779 | | - | |
| 6768 | + | |
| 6769 | + | |
| 6770 | + | |
| 6771 | + | |
| 6772 | + | |
| 6773 | + | |
6780 | 6774 | | |
6781 | 6775 | | |
6782 | | - | |
6783 | | - | |
6784 | | - | |
| 6776 | + | |
| 6777 | + | |
6785 | 6778 | | |
6786 | 6779 | | |
6787 | 6780 | | |
6788 | | - | |
6789 | | - | |
6790 | | - | |
6791 | | - | |
6792 | | - | |
6793 | | - | |
6794 | | - | |
6795 | | - | |
6796 | | - | |
6797 | 6781 | | |
6798 | 6782 | | |
6799 | 6783 | | |
| |||
6832 | 6816 | | |
6833 | 6817 | | |
6834 | 6818 | | |
| 6819 | + | |
6835 | 6820 | | |
6836 | | - | |
| 6821 | + | |
| 6822 | + | |
| 6823 | + | |
| 6824 | + | |
| 6825 | + | |
| 6826 | + | |
| 6827 | + | |
| 6828 | + | |
| 6829 | + | |
| 6830 | + | |
| 6831 | + | |
6837 | 6832 | | |
6838 | 6833 | | |
6839 | 6834 | | |
| |||
6844 | 6839 | | |
6845 | 6840 | | |
6846 | 6841 | | |
6847 | | - | |
6848 | | - | |
6849 | | - | |
6850 | | - | |
6851 | | - | |
6852 | | - | |
6853 | | - | |
6854 | | - | |
6855 | | - | |
6856 | | - | |
6857 | | - | |
6858 | | - | |
6859 | | - | |
6860 | | - | |
6861 | | - | |
6862 | | - | |
6863 | 6842 | | |
6864 | 6843 | | |
6865 | 6844 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1122 | 1122 | | |
1123 | 1123 | | |
1124 | 1124 | | |
1125 | | - | |
| 1125 | + | |
1126 | 1126 | | |
1127 | 1127 | | |
1128 | 1128 | | |
| |||
0 commit comments