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.
pg_backend_pid() → INTEGER
The PID of all backend processes can be obtained via the
Returning the current sessions backend's PID:
postgres=# SELECT pg_backend_pid(); pg_backend_pid ---------------- 1372481 (1 row)