pg_backend_pid — Get the process ID (PID) of the backend


pg_backend_pid conn


pg_backend_pid returns the process ID (PID) of the PostgreSQL backend process which is handling the connection. This is an integer that uniquely identifies this client connection among all others connected to the same PostgreSQL server. It can also be used with notifications (see pg_listen).



The handle of the connection to query

Return Value

An integer process ID (PID). This is the ID of a process running on the server, not on the client system (unless they are the same).


This command does not contact the database server - it uses information supplied by the server at connection time.

This command uses or emulates the PostgreSQL libpq function PQbackendPID.

This command was added in pgtclng-2.0.0 and in pgintcl-3.4.0. Logo

This version of the manual was produced for the Pgtcl-ng Sourceforge project web service site, which requires the logo on each page.

To download a logo-free copy of the manual, see the Pgtcl-ng project downloads area.