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)