Contents
pg_stat_get_backend_idset()
A function providing a sequential IDs for each backend
pg_stat_get_backend_idset()
is a system function which generates a list of sequential IDs for each current backend, which can then be provided to a of functions, each of which returns a specifc items of information about each backend. These functions underly the pg_stat_activity
view, but can be used to extract a subset of information provided by that view.
pg_stat_get_backend_idset()
was added in PostgreSQL 7.2.
Usage
pg_stat_get_backend_idset () → setof integer
The provided number ranges from 1
to the number of currently active backends.
Change history
- PostgreSQL 7.2
- added (commit 140ddb78)
Examples
Basic usage example for pg_stat_get_backend_idset()
:
postgres=# SELECT * FROM pg_stat_get_backend_idset(); pg_stat_get_backend_idset --------------------------- 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 (18 rows)
By itself this information is of little use; normally this query will be combined with one or more of the per-backend statistics functions:
postgres=# SELECT pg_stat_get_backend_pid(s.id) AS pid FROM (SELECT pg_stat_get_backend_idset() AS id) AS s; pid --------- 1451980 1451982 1455628 1764534 1468447 1468445 1468005 1468202 1451978 1451977 1451979 (11 rows)
References
- PostgreSQL documentation: Per-Backend Statistics Functions
Categories
See also
pg_stat_get_backend_activity(),
pg_stat_get_backend_activity_start(),
pg_stat_get_backend_client_addr(),
pg_stat_get_backend_client_port(),
pg_stat_get_backend_dbid(),
pg_stat_get_backend_pid(),
pg_stat_get_backend_start(),
pg_stat_get_backend_userid(),
pg_stat_get_backend_wait_event(),
pg_stat_get_backend_wait_event_type(),
pg_stat_get_backend_xact_start()