Re: RFC: replace pg_stat_activity.waiting with something more descriptive

From: "andres(at)anarazel(dot)de" <andres(at)anarazel(dot)de>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Vladimir Borodin <root(at)simply(dot)name>, Александр Коротков <aekorotkov(at)gmail(dot)com>, Ildus Kurbangaliev <i(dot)kurbangaliev(at)postgrespro(dot)ru>, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: RFC: replace pg_stat_activity.waiting with something more descriptive
Date: 2016-01-26 08:10:15
Message-ID: 20160126081015.GH25778@awork2.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2016-01-26 13:22:09 +0530, Amit Kapila wrote:
> @@ -633,9 +633,11 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser
> <entry>Time when the <structfield>state</> was last changed</entry>
> </row>
> <row>
> - <entry><structfield>waiting</></entry>
> - <entry><type>boolean</></entry>
> - <entry>True if this backend is currently waiting on a lock</entry>
> + <entry><structfield>wait_event</></entry>
> + <entry><type>text</></entry>
> + <entry>Wait event name if backend is currently waiting, otherwise
> + <literal>process not waiting</>
> + </entry>
> </row>
> <row>

I still think this is a considerable regression in pg_stat_activity
usability. There are lots of people out there that have queries that
automatically monitor pg_stat_activity.waiting, and automatically go to
pg_locks to understand what's going on, if there's one. With the above
definition, that got much harder. Not only do I have to write
WHERE wait_event <> 'process not waiting', but then also parse the wait
event name, to know whether the process is waiting on a heavyweight
lock, or something else!

I do think there's a considerable benefit in improving the
instrumentation here, but his strikes me as making live more complex for
more users than it makes it easier. At the very least this should be
split into two fields (type & what we're actually waiting on). I also
strongly suspect we shouldn't use in band signaling ("process not
waiting"), but rather make the field NULL if we're not waiting on
anything.

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Torsten Zuehlsdorff 2016-01-26 09:19:21 Re: Releasing in September
Previous Message Amit Kapila 2016-01-26 07:52:09 Re: RFC: replace pg_stat_activity.waiting with something more descriptive