select open change scope Open full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

FUNCTIONS / SYSTEM ADMINISTRATION FUNCTIONS

pg_terminate_backend

Read PG 18 manual ↗

Terminates the session whose backend process has the specified process ID.

Signatures & examples

pg_terminate_backend ( pid integer, timeout bigint DEFAULT 0 ) → boolean
Terminates the session whose backend process has the specified process ID. This is also allowed if the calling role is a member of the role whose backend is being terminated or the calling role has privileges of pg_signal_backend, however only superusers can terminate superuser backends. As an exception, roles with privileges of pg_signal_autovacuum_worker are permitted to terminate autovacuum worker processes, which are otherwise considered superuser backends.
Version history 7
  1. PG 17 → 18changed
  2. PG 14 → 15changed
  3. PG 13 → 14changed
  4. PG 12 → 13changed
  5. PG 9.5 → 9.6changed
  6. PG 9.4 → 9.5changed
  7. PG 9.1 → 9.2changed

Definition snapshot: 2026-09-14T13:14:25.684213+00:00@99e6866c · English manual source