pg_stat_get_backend_start()

A function reporting a when a backend started

pg_stat_get_backend_start() is a system function when the specified backend was started.

pg_stat_get_backend_start() was added in PostgreSQL 8.1.

Usage

pg_stat_get_backend_start ( integer ) → timestamp with time zone

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

The value returned by pg_stat_get_backend_start() corresponds to the column backend_start in pg_stat_activity.

The following related functions are also available:

Change history

Examples

Basic usage example for pg_stat_get_backend_start():

postgres=# SELECT pg_stat_get_backend_pid(s.backendid) AS pid,
                  pg_stat_get_backend_start(s.backendid) AS backend_start
             FROM (SELECT pg_stat_get_backend_idset() AS backendid) AS s;
   pid   |         backend_start         
---------+-------------------------------
 1451980 | 2021-07-20 02:47:15.391157+02
 1451982 | 2021-07-20 02:47:15.391324+02
 2089310 | 2021-07-21 03:17:21.371758+02
 1764534 | 2021-07-20 14:33:13.313114+02
 1451978 | 2021-07-20 02:47:15.391042+02
 1451977 | 2021-07-20 02:47:15.390958+02
 1451979 | 2021-07-20 02:47:15.391104+02
(7 rows)

Categories

System function

See also

pg_stat_activity, pg_postmaster_start_time()