Re: [HACKERS] pg_stat_activity.waiting_start - Mailing list pgsql-hackers

From Jim Nasby
Subject Re: [HACKERS] pg_stat_activity.waiting_start
Date
Msg-id da4f9739-1d82-d1a9-55d1-1c97ea80811a@BlueTreble.com
Whole thread Raw
In response to Re: [HACKERS] pg_stat_activity.waiting_start  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [HACKERS] pg_stat_activity.waiting_start  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On 12/28/16 11:25 AM, Tom Lane wrote:
> The idea of just capturing the wait start for heavyweight locks, and
> not other lock types, still seems superior to any of the alternatives
> that have been suggested ...

Is some kind of alarm a viable option for the others? If setting the 
alarm is cheap, you could just set one for say 5ms when you have to wait 
on a lock. If setting one is too expensive perhaps one could be set at 
transaction start that looks at a global (and the global would be set 
when a wait started). Obviously that means there's inaccuracy to the 
true time spent waiting, but I think that's certainly fine for 
pg_stat_activity. Most importantly, it would mean that if something has 
gone horribly wrong you'd at least have some kind of relatively accurate 
duration to work from.
-- 
Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
Experts in Analytics, Data Architecture and PostgreSQL
Data in Trouble? Get it in Treble! http://BlueTreble.com
855-TREBLE2 (855-873-2532)



pgsql-hackers by date:

Previous
From: Jim Nasby
Date:
Subject: Re: [HACKERS] merging some features from plpgsql2 project
Next
From: Tom Lane
Date:
Subject: Re: [HACKERS] pg_stat_activity.waiting_start