Repository navigation
Commit ebe2c4d
committed
Prune dead unindexed TOAST tuples directly to LP_UNUSED
In a TOAST relation, Direct TOAST chunks are addressed directly by physical
TID and have chunk_id IS NULL, meaning they are excluded from the TOAST
table's index (which is partial on WHERE chunk_id IS NOT NULL).
Consequently, when opportunistic page pruning or VACUUM encounters dead
Direct TOAST chunks, they do not require index vacuuming to clean up index
pointers. Special-case these unindexed TOAST tuples in pruneheap.c:
1. heap_tuple_header_is_unindexed_toast(): Check whether a tuple header has
NULL attributes with attribute 0 (chunk_id) being NULL.
2. heap_prune_is_unindexed_toast_tuple(): Verify that the relation is a TOAST
relation (relkind == RELKIND_TOASTVALUE) and the tuple header is unindexed.
3. heap_prune_record_dead_or_unused(): When pruning a dead normal tuple, if it
is an unindexed TOAST tuple, mark it LP_UNUSED immediately via
heap_prune_record_unused() rather than LP_DEAD, freeing the line pointer
and reclaiming page space without waiting for a two-pass index vacuum.
4. heap_page_prune_execute(): Relax the assertion for items marked LP_UNUSED
when ndead > 0 so that unindexed TOAST tuples are allowed alongside
heap-only tuples.1 parent 41696ab commit ebe2c4d
1 file changed
Lines changed: 51 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1794 | 1794 | | |
1795 | 1795 | | |
1796 | 1796 | | |
| 1797 | + | |
| 1798 | + | |
| 1799 | + | |
| 1800 | + | |
| 1801 | + | |
| 1802 | + | |
| 1803 | + | |
| 1804 | + | |
| 1805 | + | |
| 1806 | + | |
| 1807 | + | |
| 1808 | + | |
| 1809 | + | |
| 1810 | + | |
| 1811 | + | |
| 1812 | + | |
| 1813 | + | |
| 1814 | + | |
| 1815 | + | |
| 1816 | + | |
| 1817 | + | |
| 1818 | + | |
| 1819 | + | |
| 1820 | + | |
1797 | 1821 | | |
1798 | 1822 | | |
1799 | 1823 | | |
1800 | 1824 | | |
1801 | 1825 | | |
| 1826 | + | |
| 1827 | + | |
| 1828 | + | |
1802 | 1829 | | |
1803 | 1830 | | |
1804 | 1831 | | |
1805 | 1832 | | |
1806 | 1833 | | |
| 1834 | + | |
| 1835 | + | |
| 1836 | + | |
| 1837 | + | |
| 1838 | + | |
| 1839 | + | |
| 1840 | + | |
| 1841 | + | |
| 1842 | + | |
| 1843 | + | |
| 1844 | + | |
| 1845 | + | |
| 1846 | + | |
1807 | 1847 | | |
1808 | | - | |
1809 | | - | |
1810 | | - | |
1811 | | - | |
| 1848 | + | |
| 1849 | + | |
| 1850 | + | |
| 1851 | + | |
1812 | 1852 | | |
1813 | | - | |
| 1853 | + | |
1814 | 1854 | | |
1815 | 1855 | | |
1816 | 1856 | | |
| |||
1819 | 1859 | | |
1820 | 1860 | | |
1821 | 1861 | | |
1822 | | - | |
| 1862 | + | |
| 1863 | + | |
1823 | 1864 | | |
1824 | 1865 | | |
1825 | 1866 | | |
| |||
2217 | 2258 | | |
2218 | 2259 | | |
2219 | 2260 | | |
2220 | | - | |
| 2261 | + | |
| 2262 | + | |
2221 | 2263 | | |
2222 | 2264 | | |
2223 | 2265 | | |
2224 | 2266 | | |
2225 | 2267 | | |
2226 | | - | |
| 2268 | + | |
| 2269 | + | |
2227 | 2270 | | |
2228 | 2271 | | |
2229 | 2272 | | |
| |||
0 commit comments