Re: Add connection active, idle time to pg_stat_activity - Mailing list pgsql-hackers

From Sergey Dudoladov
Subject Re: Add connection active, idle time to pg_stat_activity
Date
Msg-id CAA8Fd-oS8WHe5n6bWZWW07+65dk4p+njCRCV0hMDYPVc-9c0pQ@mail.gmail.com
Whole thread Raw
In response to Re: Add connection active, idle time to pg_stat_activity  ("Drouvot, Bertrand" <bdrouvot@amazon.com>)
Responses Re: Add connection active, idle time to pg_stat_activity
Re: Add connection active, idle time to pg_stat_activity
List pgsql-hackers
Hello,

thanks for the helpful review. I have incorporated most of the
suggestions into the patch. I have also rebased and tested the patch
on top of the current master (2cd2569c72b89200).

> +       int64           active_time_diff = 0;
> +       int64           transaction_idle_time_diff = 0;
>
> I think here we can use only a single variable say "state_time_diff" for
> example, as later only one of those two is incremented anyway.

I have written it this way to avoid cluttering the critical section
between PGSTAT_(BEGIN|END)_WRITE_ACTIVITY.
With two variable one can leave only actual increments in the section
and check conditions / call TimestampDifference outside of it.

Regards,
Sergey

Attachment

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: automatically generating node support functions
Next
From: Aleksander Alekseev
Date:
Subject: Re: [PATCH] Compression dictionaries for JSONB