pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix nbtree cleanup-only VACUUM stats inaccuracies.
2+ messages / 1 participants
[nested] [flat]

* pgsql: Fix nbtree cleanup-only VACUUM stats inaccuracies.
@ 2020-11-05 02:43  Peter Geoghegan <pg@bowt.ie>
  0 siblings, 0 replies; 2+ messages in thread

From: Peter Geoghegan @ 2020-11-05 02:43 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix nbtree cleanup-only VACUUM stats inaccuracies.

Logic for counting heap TIDs from posting list tuples (added by commit
0d861bbb) was faulty.  It didn't count any TIDs/index tuples in the
event of no callback being set.  This meant that we incorrectly counted
no index tuples in clean-up only VACUUMs, which could lead to
pg_class.reltuples being spuriously set to 0 in affected indexes.

To fix, go back to counting items from the page in cases where there is
no callback.  This approach isn't very accurate, but it works well
enough in practice while avoiding the expense of accessing every index
tuple during cleanup-only VACUUMs.

Author: Peter Geoghegan <pg@bowt.ie>
Reported-By: Jehan-Guillaume de Rorthais <jgdr@dalibo.com>
https://postgr.es/m/20201023174451.69e358f1@firost
Backpatch: 13-, where nbtree deduplication was introduced

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/48e1291342dd7771cf8c67aa1d7ec1f394b95dd8

Modified Files
--------------
src/backend/access/nbtree/nbtree.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* pgsql: Fix nbtree cleanup-only VACUUM stats inaccuracies.
@ 2020-11-05 02:43  Peter Geoghegan <pg@bowt.ie>
  0 siblings, 0 replies; 2+ messages in thread

From: Peter Geoghegan @ 2020-11-05 02:43 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix nbtree cleanup-only VACUUM stats inaccuracies.

Logic for counting heap TIDs from posting list tuples (added by commit
0d861bbb) was faulty.  It didn't count any TIDs/index tuples in the
event of no callback being set.  This meant that we incorrectly counted
no index tuples in clean-up only VACUUMs, which could lead to
pg_class.reltuples being spuriously set to 0 in affected indexes.

To fix, go back to counting items from the page in cases where there is
no callback.  This approach isn't very accurate, but it works well
enough in practice while avoiding the expense of accessing every index
tuple during cleanup-only VACUUMs.

Author: Peter Geoghegan <pg@bowt.ie>
Reported-By: Jehan-Guillaume de Rorthais <jgdr@dalibo.com>
https://postgr.es/m/20201023174451.69e358f1@firost
Backpatch: 13-, where nbtree deduplication was introduced

Branch
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/02c9386ca4f706364904be2720e2d09916e2b619

Modified Files
--------------
src/backend/access/nbtree/nbtree.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2020-11-05 02:43 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-11-05 02:43 pgsql: Fix nbtree cleanup-only VACUUM stats inaccuracies. Peter Geoghegan <pg@bowt.ie>
2020-11-05 02:43 pgsql: Fix nbtree cleanup-only VACUUM stats inaccuracies. Peter Geoghegan <pg@bowt.ie>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox