Improve the IndexVacuumInfo/IndexBulkDeleteResult API to allow somewhat sane
behavior in cases where we don't know the heap tuple count accurately; in particular partial vacuum, but this also makes the API a bit more useful for ANALYZE. This patch adds "estimated_count" flags to both structs so that an approximate count can be flagged as such, and adjusts the logic so that approximate counts are not used for updating pg_class.reltuples. This fixes my previous complaint that VACUUM was putting ridiculous values into pg_class.reltuples for indexes. The actual impact of that bug is limited, because the planner only pays attention to reltuples for an index if the index is partial; which probably explains why beta testers hadn't noticed a degradation in plan quality from it. But it needs to be fixed. The whole thing is a bit messy and should be redesigned in future, because reltuples now has the potential to drift quite far away from reality when a long period elapses with no non-partial vacuums. But this is as good as it's going to get for 8.4.
Showing
- src/backend/access/gin/ginvacuum.c 2 additions, 1 deletionsrc/backend/access/gin/ginvacuum.c
- src/backend/access/gist/gistvacuum.c 3 additions, 2 deletionssrc/backend/access/gist/gistvacuum.c
- src/backend/access/hash/hash.c 4 additions, 1 deletionsrc/backend/access/hash/hash.c
- src/backend/access/nbtree/nbtree.c 6 additions, 4 deletionssrc/backend/access/nbtree/nbtree.c
- src/backend/catalog/index.c 3 additions, 2 deletionssrc/backend/catalog/index.c
- src/backend/commands/analyze.c 3 additions, 2 deletionssrc/backend/commands/analyze.c
- src/backend/commands/vacuum.c 23 additions, 11 deletionssrc/backend/commands/vacuum.c
- src/backend/commands/vacuumlazy.c 19 additions, 11 deletionssrc/backend/commands/vacuumlazy.c
- src/backend/postmaster/pgstat.c 8 additions, 1 deletionsrc/backend/postmaster/pgstat.c
- src/include/access/genam.h 10 additions, 4 deletionssrc/include/access/genam.h
Loading
Please register or sign in to comment