From: | Kuntal Ghosh <kuntalghosh(dot)2007(at)gmail(dot)com> |
---|---|
To: | Rafia Sabih <rafia(dot)pghackers(at)gmail(dot)com> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Add connection active, idle time to pg_stat_activity |
Date: | 2021-11-29 15:04:14 |
Message-ID: | CAGz5QCLxnOpcPdjz-P0N_e3oT7SP0rz+Z9VmXCzKNywMpmHpqQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Fri, Oct 22, 2021 at 1:53 PM Rafia Sabih <rafia(dot)pghackers(at)gmail(dot)com> wrote:
> 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.
It's definitely useful to know how much time a backend has spent for
query executions. Once you've this info, you can easily calculate the
idle time using this information: (now() - backend_start) -
active_time. But, I'm wondering why you need to distinguish between
idle and idle in transactions - what's the usage? Either the backend
is doing some work or it sits idle. Another useful information would
be when the last query execution was ended. From this information, you
can figure out whether a backend is idle for a long time since the
last execution and the execution time of the last query (query_end -
query_start).
You also need to update the documentation.
--
Thanks & Regards,
Kuntal Ghosh
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2021-11-29 15:05:28 | Re: Catching missing Datum conversions |
Previous Message | Tom Lane | 2021-11-29 15:03:48 | Re: Rationalizing declarations of src/common/ variables |