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

From: Ildus Kurbangaliev <i(dot)kurbangaliev(at)postgrespro(dot)ru>
To: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Alexander Korotkov <aekorotkov(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Subject: Re: RFC: replace pg_stat_activity.waiting with something more descriptive
Date: 2015-07-21 10:11:36
Message-ID: 55AE1AD8.8040409@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox
Thread:
Lists: pgsql-hackers

Hello.
I did some refactoring to previous patch. Improvements:

1) Wait is determined by class and event without affecting to atomic
usage of it.
They are still stored in one variable. This improvement gives an
opportunity to make
more detailed views later (waits can be grouped by class).
2) Only active wait of each backend is visible. pg_report_wait_end()
function called
on the end of wait and clears it.
3) Wait name determination was optimized (last version used cycles for
each of them,
and was very heavy). I added lazy `group` field to LWLock, which used as
index in
lwlock names array.
4) New wait can be added by more simpler way. For example an individual
lwlock
requires only specifying its name in LWLock names arrayb
5) Added new types of waits: Storage, Network, Latch

This patch is more informative and it'll be easier to extend.

Sample:

b1=# select pid, wait_event from pg_stat_activity;

pid | wait_event
-------+------------------------------
17099 | LWLocks: BufferCleanupLock
17100 | Locks: Transaction
17101 | LWLocks: BufferPartitionLock
17102 |
17103 | Network: READ
17086 |
(6 rows)

--
Ildus Kurbangaliev
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

Attachment Content-Type Size
extend_pg_stat_activity_v2.patch text/x-patch 33.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2015-07-21 10:18:44 Re: RFC: replace pg_stat_activity.waiting with something more descriptive
Previous Message Andres Freund 2015-07-21 10:05:09 Re: "make check" changes have caused buildfarm deterioration.