mirror of
https://github.com/postgres/postgres.git
synced 2025-07-07 00:36:50 +03:00
Reintroduce dead tuple counter in pg_stat_progress_vacuum.
Commit 667e65aac3
changed both num_dead_tuples and max_dead_tuples
columns to dead_tuple_bytes and max_dead_tuple_bytes columns,
respectively. But as per discussion, the number of dead tuples
collected still provides meaningful insights for users.
This commit reintroduces the column for the count of dead tuples,
renamed as num_dead_item_ids. It avoids confusion with the number of
dead tuples removed by VACUUM, which includes dead heap-only tuples
but excludes any pre-existing LP_DEAD items left behind by
opportunistic pruning.
Bump catalog version.
Reviewed-by: Peter Geoghegan, Álvaro Herrera, Andrey Borodin
Discussion: https://postgr.es/m/CAD21AoBL5sJE9TRWPyv%2Bw7k5Ee5QAJqDJEDJBUdAaCzGWAdvZw%40mail.gmail.com
This commit is contained in:
@ -2883,13 +2883,19 @@ dead_items_add(LVRelState *vacrel, BlockNumber blkno, OffsetNumber *offsets,
|
||||
int num_offsets)
|
||||
{
|
||||
TidStore *dead_items = vacrel->dead_items;
|
||||
const int prog_index[2] = {
|
||||
PROGRESS_VACUUM_NUM_DEAD_ITEM_IDS,
|
||||
PROGRESS_VACUUM_DEAD_TUPLE_BYTES
|
||||
};
|
||||
int64 prog_val[2];
|
||||
|
||||
TidStoreSetBlockOffsets(dead_items, blkno, offsets, num_offsets);
|
||||
vacrel->dead_items_info->num_items += num_offsets;
|
||||
|
||||
/* update the memory usage report */
|
||||
pgstat_progress_update_param(PROGRESS_VACUUM_DEAD_TUPLE_BYTES,
|
||||
TidStoreMemoryUsage(dead_items));
|
||||
/* update the progress information */
|
||||
prog_val[0] = vacrel->dead_items_info->num_items;
|
||||
prog_val[1] = TidStoreMemoryUsage(dead_items);
|
||||
pgstat_progress_update_multi_param(2, prog_index, prog_val);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1221,7 +1221,8 @@ CREATE VIEW pg_stat_progress_vacuum AS
|
||||
S.param2 AS heap_blks_total, S.param3 AS heap_blks_scanned,
|
||||
S.param4 AS heap_blks_vacuumed, S.param5 AS index_vacuum_count,
|
||||
S.param6 AS max_dead_tuple_bytes, S.param7 AS dead_tuple_bytes,
|
||||
S.param8 AS indexes_total, S.param9 AS indexes_processed
|
||||
S.param8 AS num_dead_item_ids, S.param9 AS indexes_total,
|
||||
S.param10 AS indexes_processed
|
||||
FROM pg_stat_get_progress_info('VACUUM') AS S
|
||||
LEFT JOIN pg_database D ON S.datid = D.oid;
|
||||
|
||||
|
Reference in New Issue
Block a user