Add pg_stat_role system view for per-role cumulative statistics#5
Open
shinyaaa wants to merge 1 commit into
Open
Add pg_stat_role system view for per-role cumulative statistics#5shinyaaa wants to merge 1 commit into
shinyaaa wants to merge 1 commit into
Conversation
The new view reports, for each role, the number of sessions established and the number of committed and rolled back transactions, along with the time at which the role's statistics were last reset. Statistics are attributed to the login role of a session, so SET ROLE and SECURITY DEFINER functions do not redirect where activity is counted. Only client backends are counted, matching the session accounting of pg_stat_database. This adds a new variable-numbered cumulative statistics kind PGSTAT_KIND_ROLE, keyed by role OID and shared across databases. Stats entries are created by CREATE ROLE and dropped by DROP ROLE (transactionally), survive clean restarts, and can be reset with the new pg_stat_reset_role_stats() function. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012dKR6zB32MW351m4dsoXPg
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The new view reports, for each role, the number of sessions
established and the number of committed and rolled back transactions,
along with the time at which the role's statistics were last reset.
Statistics are attributed to the login role of a session, so SET ROLE
and SECURITY DEFINER functions do not redirect where activity is
counted. Only client backends are counted, matching the session
accounting of pg_stat_database.
This adds a new variable-numbered cumulative statistics kind
PGSTAT_KIND_ROLE, keyed by role OID and shared across databases.
Stats entries are created by CREATE ROLE and dropped by DROP ROLE
(transactionally), survive clean restarts, and can be reset with the
new pg_stat_reset_role_stats() function.
Co-Authored-By: Claude Fable 5 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_012dKR6zB32MW351m4dsoXPg