pg_stat_get_backend_wait_event()

A function returning a backend's wait event name

pg_stat_get_backend_wait_event() is a system function returning the current wait event name for the specified backend.

pg_stat_get_backend_wait_event() was added in PostgreSQL 9.6.

Usage

pg_stat_get_backend_wait_event ( integer ) → text

The backend is specified by a backend ID number reported by pg_stat_get_backend_idset(); see below for an execution example.

NULL is returned if there is no wait event.

The value returned by pg_stat_get_backend_wait_event() corresponds to the column wait_event in pg_stat_activity.

The following related functions are also available:

Change history

Examples

Basic usage example for pg_stat_get_backend_wait_event():

postgres=# SELECT pg_stat_get_backend_pid(s.backendid) AS pid,
                  pg_stat_get_backend_wait_event(s.backendid) AS wait_event
             FROM (SELECT pg_stat_get_backend_idset() AS backendid) AS s;
   pid   |     wait_event      
---------+---------------------
 1451980 | AutoVacuumMain
 1451982 | LogicalLauncherMain
 2382558 | 
 1764534 | ClientRead
 1451978 | 
 1451977 | 
 1451979 | 
(7 rows)

Categories

System function

See also

pg_stat_activity