-
Notifications
You must be signed in to change notification settings - Fork 0
Add pg_stat_session #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
a56bc66
to
52acfe4
Compare
Don't you think that the task of differentiating "5 hours of idle-in-transaction time in a single block and the same 5 hours accumulated across 300 mini-idles" can be done by just calculating the |
src/include/utils/backend_status.h
Outdated
typedef struct PgBackendSessionStatus | ||
{ | ||
/* Counters accumulated since the start of the session */ | ||
int64 total_active_time; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PgStat_Counter instead of int64?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I vaguely recall we discussed in an earleir version we go with int64.
I will leave that comment unresolved for now to return to it later
To be fair, counters are the solution requested on the mailing list. |
122612a
to
9e2db1c
Compare
@@ -618,6 +643,21 @@ pgstat_report_activity(BackendState state, const char *cmd_str) | |||
beentry->st_activity_start_timestamp = start_timestamp; | |||
} | |||
|
|||
beentry->st_session.total_running_time += st_session_diff.total_running_time; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I welcome any suggestions on improving this part.
@hughcapet can you double-check the values reported by |
9e2db1c
to
31f781e
Compare
Author: Sergey Dudoladov Adds pg_stat_session view to track statistics accumulated during lifetime of a session (client backend). catversion bump is necessary due to a new view / function Reviewed-by: Aleksander Alekseev, Bertrand Drouvot, and Atsushi Torikoshi Discussion: https://www.postgresql.org/message-id/flat/CA%2BFpmFcJF0vwi-SWW0wYO-c-FbhyawLq4tCpRDCJJ8Bq%3Dja-gA%40mail.gmail.com
31f781e
to
2a4a7c1
Compare
catversion bump because of the change in the contents of pg_stat_activity
Author: Sergey Dudoladov
Reviewed-by:
Discussion:
https://www.postgresql.org/message-id/flat/CA%2BFpmFcJF0vwi-SWW0wYO-c-FbhyawLq4tCpRDCJJ8Bq%3Dja-gA%40mail.gmail.com
succeeds an older patch done at #5