Re: Proposal: expose heavyweight lock wait start time in pg_stat_activity - Mailing list pgsql-hackers

From Sami Imseih
Subject Re: Proposal: expose heavyweight lock wait start time in pg_stat_activity
Date
Msg-id CAN12+YKErWDGbhD=nV8+MXVs9vadJC11YYp10apajZKsJUTv6Q@mail.gmail.com
Whole thread
In response to Proposal: expose heavyweight lock wait start time in pg_stat_activity  (Alex Shapalov <shapalov@gmail.com>)
Responses Re: Proposal: expose heavyweight lock wait start time in pg_stat_activity
List pgsql-hackers
Hi,

>
> I'd like to propose exposing the start time of the current heavyweight lock wait in pg_stat_activity, perhaps as:
>
> lock_wait_start timestamptz
>
> pg_stat_activity currently tells us that a backend is waiting on a lock through wait_event_type and wait_event, but
notwhen that wait started.
 

pg_locks.waitstart already provides this information. Any reason that
is not sufficient?

pg_locks is meant to be joined with pg_stat_activity anyhow. The two
views aren't read
from the same snapshot, so they can be out of sync. But that's already
true inside
pg_stat_activity, as the docs say:

"To keep the reporting overhead low, the system does
not attempt to synchronize different aspects of activity data for a
backend. As a result,
ephemeral discrepancies may exist between the view's columns."

The same will be true even if we add waitstart to pg_stat_activity.

--
Sami Imseih
Amazon Web Services (AWS)



pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: [Patch] Fix pg_get_multixact_stats() over-reporting members on a hot standby
Next
From: Michael Paquier
Date:
Subject: Re: [Proposal] Expose internal MultiXact member count function for efficient monitoring