Re: [HACKERS] exposing wait events for non-backends (was: Trackingwait event for latches) - Mailing list pgsql-hackers

From Kuntal Ghosh
Subject Re: [HACKERS] exposing wait events for non-backends (was: Trackingwait event for latches)
Date
Msg-id CAGz5QCLKBGfHX2EeND6GJF62GVyBKSx7nNdAmSKW2wBZpiNX5w@mail.gmail.com
Whole thread Raw
In response to Re: [HACKERS] exposing wait events for non-backends (was: Trackingwait event for latches)  (Andres Freund <andres@anarazel.de>)
Responses Re: [HACKERS] exposing wait events for non-backends (was: Trackingwait event for latches)  (Michael Paquier <michael.paquier@gmail.com>)
List pgsql-hackers
On Fri, Mar 10, 2017 at 3:11 AM, Andres Freund <andres@anarazel.de> wrote:
> On 2017-03-09 16:37:29 -0500, Tom Lane wrote:
>> Robert Haas <robertmhaas@gmail.com> writes:
>> > On Thu, Mar 9, 2017 at 2:30 PM, Peter Eisentraut
>> > <peter.eisentraut@2ndquadrant.com> wrote:
>> >> In practice, I think it's common to do a quick select * from
>> >> pg_stat_activity to determine whether a database instance is in use.
>>
>> > I thought of the same kind of thing, and it was discussed upthread.
>> > There seemed to be more votes for keeping it all in one view, but that
>> > could change if more people vote.
>>
>> I've not been paying much attention to this thread, but it seems like
>> something that would help Peter's use-case and have other uses as well
>> is a new column that distinguishes different process types --- user
>> session, background worker, autovacuum worker, etc.
>
> The patches upthread add precisely such a column.
>
The patch exposes auxiliary processes, autovacuum launcher and
bgworker along with other backends in pg_stat_activity. It also adds
an extra column, named proc_type (suggested by Craig
and Robert), to indicate the type of process in pg_stat_activity view.
proc_type includes:

* client backend
* autovacuum launcher
* wal sender
* bgworker
* writer
* checkpointer
* wal writer
* wal receiver

Here is the present output with the relevant columns.
postgres=# SELECT wait_event_type, wait_event, state, proc_type FROM
pg_stat_activity;wait_event_type |     wait_event      | state  |      proc_type
-----------------+---------------------+--------+---------------------Activity        | AutoVacuumMain      | idle   |
autovacuumlauncherActivity        | LogicalLauncherMain | idle   | bgworkerActivity        | WalSenderMain       | idle
 | wal sender                |                     | active | client backendActivity        | BgWriterMain        |
idle  | writerActivity        | CheckpointerMain    | idle   | checkpointerActivity        | WalWriterMain       | idle
 | wal writer
 
(7 rows)


-- 
Thanks & Regards,
Kuntal Ghosh
EnterpriseDB: http://www.enterprisedb.com



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [HACKERS] Speed up Clog Access by increasing CLOG buffers
Next
From: Peter Eisentraut
Date:
Subject: Re: [HACKERS] PATCH: Configurable file mode mask