Vacuum currently counts and logs the number of pages of a relation with newly frozen tuples. It does not count the number of pages newly set all-frozen in the visibility map.
The number of pages set all-frozen in the visibility map by a given vacuum can be useful when analyzing which normal vacuums reduce the number of pages future aggressive vacuum need to scan. Also, empty pages that are set all-frozen in the VM don't show up in the count of pages with newly frozen tuples. When making sense of the result of visibilitymap_summary() for a relation, it's helpful to know how many pages were set all-frozen in the VM by each vacuum. The attached patch set makes visibilitymap_set() return the old value of the block's VM bits and then uses that to increment a new counter in the LVRelState. Here is example logging output with the patch: create table foo (a int, b int) with (autovacuum_enabled = false); insert into foo select generate_series(1,1000), 1; delete from foo where a > 50; vacuum (freeze, verbose) foo; finished vacuuming "melanieplageman.public.foo": index scans: 0 pages: 4 removed, 1 remain, 5 scanned (100.00% of total) tuples: 950 removed, 50 remain, 0 are dead but not yet removable frozen: 1 pages from table (20.00% of total) had 50 tuples frozen. 5 pages set all-frozen in the VM - Melanie
v1-0003-Count-pages-set-all-frozen-in-VM-during-vacuum.patch
Description: Binary data
v1-0002-Make-visibilitymap_set-return-previous-state-of-v.patch
Description: Binary data
v1-0001-Rename-LVRelState-frozen_pages.patch
Description: Binary data