Add pg_get_multixact_stats() This new function exposes at SQL level some information related to multixacts, not available until now. This data is useful for monitoring purposes, especially for workloads that make a heavy use of multixacts: - num_mxids, number of MultiXact IDs in use. - num_members, number of member entries in use. - members_size, bytes used by num_members in pg_multixact/members/. - oldest_multixact: oldest MultiXact still needed.
This patch has been originally proposed when MultiXactOffset was still 32 bits, to monitor wraparound. This part is not relevant anymore since bd8d9c9bdfa0 that has widen MultiXactOffset to 64 bits. The monitoring of disk space usage for the members is still relevant. Some tests are added to check this function, in the shape of one isolation test with concurrent transactions that take a ROW SHARE lock, and some SQL tests for pg_read_all_stats. Some documentation is added to explain some patterns that can come from the information provided by the function. Bump catalog version. Author: Naga Appani <[email protected]> Reviewed-by: Ashutosh Bapat <[email protected]> Reviewed-by: Michael Paquier <[email protected]> Reviewed-by: Atsushi Torikoshi <[email protected]> Discussion: https://postgr.es/m/ca+qey+aasyk6wvbw4qyzhz4bahhycday_q5ecmhkev_eb9c...@mail.gmail.com Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/97b101776ce23dd6c4abbdae213806bc24ed6133 Modified Files -------------- doc/src/sgml/func/func-info.sgml | 33 +++++++ doc/src/sgml/maintenance.sgml | 39 +++++++-- src/backend/utils/adt/multixactfuncs.c | 53 +++++++++++ src/include/catalog/catversion.h | 2 +- src/include/catalog/pg_proc.dat | 7 ++ src/test/isolation/expected/multixact-stats.out | 89 +++++++++++++++++++ src/test/isolation/isolation_schedule | 1 + src/test/isolation/specs/multixact-stats.spec | 111 ++++++++++++++++++++++++ src/test/regress/expected/misc_functions.out | 29 +++++++ src/test/regress/sql/misc_functions.sql | 15 ++++ 10 files changed, 373 insertions(+), 6 deletions(-)
