On Tue, Aug 3, 2021 at 12:27 PM Matthias van de Meent <boekewurm+postg...@gmail.com> wrote: > This change makes it easier and more worthwile to implement a further > optimization for the checkpointer and/or buffer manager to determine > that 1.) this page is now empty, and that 2.) we can therefore write a > specialized WAL record specifically tuned for empty pages instead of > FPI records. No additional pages are changed, because each time the > line pointer array is shrunk, we've already either marked dead tuples > as unused (2nd phase vacuum) or removed HOT line pointers / truncated > dead tuples to lp_dead line pointers (heap_page_prune).
We generate an FPI the first time a page is modified after a checkpoint. The FPI consists of the page *after* it has been modified. Presumably this optimization would need the heap page to be 100% empty, so we're left with what seems to me to be a very narrow target for optimization; something that is naturally rare. A fully-empty page seems quite unlikely in the case of xl_heap_vacuum records, and impossible in the case of xl_heap_prune records. Even with all the patches, working together. Have I missed something? -- Peter Geoghegan