public inbox for [email protected]
help / color / mirror / Atom feedFrom: Kyotaro Horiguchi <[email protected]>
To: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Subject: Re: Add connection active, idle time to pg_stat_activity
Date: Fri, 28 Jan 2022 14:43:03 +0900 (JST)
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <CAA8Fd-qyHi5PbaUhKci+NA0N_j5J9MY2xOQ=ZznjzNhvz91QRA@mail.gmail.com>
<20220127123656.etovnhimr5sgp37f@jrouhaud>
<[email protected]>
At Fri, 28 Jan 2022 14:36:31 +0900 (JST), Kyotaro Horiguchi <[email protected]> wrote in
> Hi.
>
> At Thu, 27 Jan 2022 20:36:56 +0800, Julien Rouhaud <[email protected]> wrote in
> > On Thu, Jan 27, 2022 at 11:43:26AM +0100, Sergey Dudoladov wrote:
> > >
> > > Per agreement with Rafia I have reworked the patch in the past days.
> > > The new version 6 is now ready for review.
> >
> > Great, thanks a lot Sergey!
> >
> > The cfbot is happy with this new version:
> > https://cirrus-ci.com/github/postgresql-cfbot/postgresql/commitfest/36/3405
>
> I think we can easily add the duration of the current state to the two
> in pg_stat_get_activity and it would offer better information.
>
>
> if (beentry->st_state == STATE_RUNNING ||
> beentry->st_state == STATE_FASTPATH)
> - pgstat_count_conn_active_time((PgStat_Counter) secs * 1000000 + usecs);
> + {
> + pgstat_count_conn_active_time((PgStat_Counter) usecs_diff);
> + beentry->st_total_active_time += usecs_diff;
> + }
>
> The two lines operates exactly the same way on variables with slightly
> different behavior. pgStatActiveTime is reported at transaction end
> and reset at every tabstat reporting. st_total_active_time is reported
> immediately and reset at session end. Since we do the latter, the
> first can be omitted by remembering the last values for the local
> variables at every reporting. This needs additional two exporting
Of course it's typo(?) of "values of the shared variables".
Sorry for the mistake.
> function in pgstatfuncs like pgstat_get_my_queryid so others might
> think differently.
>
> The write operation to beentry needs to be enclosed by
> PGSTAT_BEGIN/END_WRITE_ACTIVITY(). In that perspective, it would be
> better to move that writes to the PGSTAT_WRITE_ACTIVITY section just
> below.
regards.
--
Kyotaro Horiguchi
NTT Open Source Software Center
view thread (3+ messages)
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
Subject: Re: Add connection active, idle time to pg_stat_activity
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox