Track per-relation cumulative time spent in [auto]vacuum and [auto]analyze
commit30a6ed0ce4bb18212ec38cdb537ea4b43bc99b83
authorMichael Paquier <michael@paquier.xyz>
Tue, 28 Jan 2025 00:57:32 +0000 (28 09:57 +0900)
committerMichael Paquier <michael@paquier.xyz>
Tue, 28 Jan 2025 00:57:32 +0000 (28 09:57 +0900)
tree43b178ff45834125c31b83393d38cf65a691a422
parent5afaba6297a8dd6999c8bc9f517a3ad38bd39652
Track per-relation cumulative time spent in [auto]vacuum and [auto]analyze

This commit adds four fields to the statistics of relations, aggregating
the amount of time spent for each operation on a relation:
- total_vacuum_time, for manual vacuum.
- total_autovacuum_time, for vacuum done by the autovacuum daemon.
- total_analyze_time, for manual analyze.
- total_autoanalyze_time, for analyze done by the autovacuum daemon.

This gives users the option to derive the average time spent for these
operations with the help of the related "count" fields.

Bump catalog version (for the catalog changes) and PGSTAT_FILE_FORMAT_ID
(for the additions in PgStat_StatTabEntry).

Author: Sami Imseih
Reviewed-by: Bertrand Drouvot, Michael Paquier
Discussion: https://postgr.es/m/CAA5RZ0uVOGBYmPEeGF2d1B_67tgNjKx_bKDuL+oUftuoz+=Y1g@mail.gmail.com
doc/src/sgml/monitoring.sgml
src/backend/access/heap/vacuumlazy.c
src/backend/catalog/system_views.sql
src/backend/commands/analyze.c
src/backend/utils/activity/pgstat_relation.c
src/backend/utils/adt/pgstatfuncs.c
src/include/catalog/catversion.h
src/include/catalog/pg_proc.dat
src/include/pgstat.h
src/test/regress/expected/rules.out