A function returning the backend's current transaction start time

pg_stat_get_backend_xact_start() is a system function returning the start time of the current transaction in the specified backend.

pg_stat_get_backend_xact_start() was added in PostgreSQL 8.3.


pg_stat_get_backend_xact_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_xact_start() corresponds to the column xact_start in pg_stat_activity.

The following related functions are also available:

Change history


Basic usage example for pg_stat_get_backend_xact_start():

postgres=# SELECT pg_stat_get_backend_pid(s.backendid) AS pid,
                  pg_stat_get_backend_xact_start(s.backendid) AS backend_start
             FROM (SELECT pg_stat_get_backend_idset() AS backendid) AS s;
   pid   |         backend_start         
 1451980 | 
 1451982 | 
 2382558 | 2021-07-21 14:19:15.932239+02
 1764534 | 
 1451978 | 
 1451977 | 
 1451979 | 
(7 rows)


System function

See also