pg_backend_pid()

A function returning the current backend's PID

pg_backend_pid() is a system function returning the current backend's PID.

pg_backend_pid() was added in PostgreSQL 7.3.

Usage

pg_backend_pid() → INTEGER

The PID of all backend processes can be obtained via the pg_stat_activity view.

Change history

Examples

Returning the current sessions backend's PID:

postgres=# SELECT pg_backend_pid();
 pg_backend_pid 
----------------
        1372481
(1 row)

Categories

System function