PostgreSQL pg_backend_pid() Function

The PostgreSQL pg_backend_pid() function returns the process ID of the server process to which the current session is connected.

pg_backend_pid() Syntax

Here is the syntax of the PostgreSQL pg_backend_pid() function:

pg_backend_pid() -> integer

Parameters

The PostgreSQL pg_backend_pid() function does not require any parameters.

Return value

The PostgreSQL pg_backend_pid() function returns a number that is the process ID of the server process to which the current session is connected.

pg_backend_pid() Examples

To get the process ID of the server process to which the current session is connected, use the following statement with the pg_backend_pid() function:

SELECT pg_backend_pid();
 pg_backend_pid
----------------
           1152

Note that your values ​​may vary.