From: | Rafia Sabih <rafia(dot)pghackers(at)gmail(dot)com> |
---|---|
To: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Add connection active, idle time to pg_stat_activity |
Date: | 2021-10-26 11:46:48 |
Message-ID: | CA+FpmFfeABT7Eei-VRZC3fm0ebarWZBgQBaox9gDeVBNYnAaFg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Fri, 22 Oct 2021 at 10:22, Rafia Sabih <rafia(dot)pghackers(at)gmail(dot)com> wrote:
>
> Hello there hackers,
>
> We at Zalando have faced some issues around long running idle
> transactions and were thinking about increasing the visibility of
> pg_stat_* views to capture them easily. What I found is that currently
> in pg_stat_activity there is a lot of good information about the
> current state of the process, but it is lacking the cumulative
> information on how much time the connection spent being idle, idle in
> transaction or active, we would like to see cumulative values for each
> of these per connection. I believe it would be helpful for us and more
> people out there if we could have total connection active and idle
> time displayed in pg_stat_activity.
>
> To provide this information I was digging into how the statistics
> collector is working and found out there is already information like
> total time that a connection is active as well as idle computed in
> pgstat_report_activity[1]. Ideally, this would be the values we would
> like to see per process in pg_stat_activity.
>
> Curious to know your thoughts on this.
>
> [1]https://github.com/postgres/postgres/blob/cd3f429d9565b2e5caf0980ea7c707e37bc3b317/src/backend/utils/activity/backend_status.c#L593
>
>
>
> --
> Regards,
> Rafia Sabih
Please find the attached patch for the idea of our intentions.
It basically adds three attributes for idle, idle_in_transaction, and
active time respectively.
Please let me know your views on this and I shall add this to the
upcoming commitfest for better tracking.
--
Regards,
Rafia Sabih
Attachment | Content-Type | Size |
---|---|---|
v1_add_idle_active_time.patch | text/x-patch | 6.4 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Aleksander Alekseev | 2021-10-26 11:48:47 | Re: Refactoring: join MakeSingleTupleTableSlot() and MakeTupleTableSlot() |
Previous Message | Masahiko Sawada | 2021-10-26 11:25:06 | Re: Trap errors from streaming child in pg_basebackup to exit early |