Re: 64-bit XIDs in deleted nbtree pages
Peter Geoghegan <pg@bowt.ie>
Attachments
- v8-0001-Recycle-pages-deleted-during-same-VACUUM.patch (text/x-patch) patch v8-0001
- v8-0002-VACUUM-ANALYZE-Distrust-cleanup-only-stats.patch (text/x-patch) patch v8-0002
- v8-0003-Remove-vacuum_cleanup_index_scale_factor-GUC-para.patch (text/x-patch) patch v8-0003
On Mon, Mar 1, 2021 at 1:40 PM Peter Geoghegan <pg@bowt.ie> wrote: > > Since it seems not a bug I personally think we don't need to do > > anything for back branches. But if we want not to trigger an index > > scan by vacuum_cleanup_index_scale_factor, we could change the default > > value to a high value (say, to 10000) so that it can skip an index > > scan in most cases. > > One reason to remove vacuum_cleanup_index_scale_factor in the back > branches is that it removes any need to fix the > "IndexVacuumInfo.num_heap_tuples is inaccurate outside of > btvacuumcleanup-only VACUUMs" bug -- it just won't matter if > btm_last_cleanup_num_heap_tuples is inaccurate anymore. (I am still > not sure about backpatch being a good idea, though.) Attached is v8 of the patch series, which has new patches. No real changes compared to v7 for the first patch, though. There are now two additional prototype patches to remove the vacuum_cleanup_index_scale_factor GUC/param along the lines we've discussed. This requires teaching VACUUM ANALYZE about when to trust VACUUM cleanup to set the statistics (that's what v8-0002* does). The general idea for VACUUM ANALYZE in v8-0002* is to assume that cleanup-only VACUUMs won't set the statistics accurately -- so we need to keep track of this during VACUUM (in case it's a VACUUM ANALYZE, which now needs to know if index vacuuming was "cleanup only" or not). This is not a new thing for hash indexes -- they never did anything in the cleanup-only case (hashvacuumcleanup() just returns NULL). And now nbtree does the same thing (usually). Not all AMs will, but the new assumption is much better than the one it replaces. I thought of another existing case that violated the faulty assumption made by VACUUM ANALYZE (which v8-0002* fixes): VACUUM's INDEX_CLEANUP feature (which was added to Postgres 12 by commit a96c41feec6) is another case where VACUUM does nothing with indexes. VACUUM ANALYZE mistakenly considers that index vacuuming must have run and set the pg_class statistics to an accurate value (more accurate than it is capable of). But with INDEX_CLEANUP we won't even call amvacuumcleanup(). -- Peter Geoghegan
Commits
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Recycle nbtree pages deleted during same VACUUM.
- 9dd963ae2534 14.0 landed
-
VACUUM VERBOSE: Count "newly deleted" index pages.
- 237636183909 14.0 landed
-
Use full 64-bit XIDs in deleted nbtree pages.
- e5d8a9990304 14.0 landed
-
Fix nbtree cleanup-only VACUUM stats inaccuracies.
- 48e1291342dd 14.0 cited
-
Fix undercounting in VACUUM VERBOSE output.
- 73a076b03f1c 13.0 cited
-
Delete empty pages in each pass during GIST VACUUM.
- 4e514c6180fb 13.0 cited
-
Use full 64-bit XID for checking if a deleted GiST page is old enough.
- 6655a7299d83 13.0 cited
-
Allow VACUUM to be run with index cleanup disabled.
- a96c41feec6b 12.0 cited
-
Skip full index scan during cleanup of B-tree indexes when possible
- 857f9c36cda5 11.0 cited
-
Do index FSM vacuuming sooner.
- c79f6df75dd3 11.0 cited
-
Avoid early reuse of btree pages, causing incorrect query results.
- d3abbbebe52e 9.2.0 cited
-
Clean up API for ambulkdelete/amvacuumcleanup as per today's discussion.
- e57345975cf8 8.2.0 cited