pg_setpriority
pg_setpriority · Get or change Unix scheduling priority for PostgreSQL processes
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 100188 | pg_setpriority | pg_setpriority | 1.0 | ADMIN | Unknown | C |
Usage
Sources:
pg_setpriority version 1.0 wraps the operating system’s process-priority calls. setpriority(integer) changes the nice value of the current PostgreSQL backend, while getpriority(integer) reads a process priority and defaults to the current backend.
Example
The change lasts for the backend process, so it can affect later sessions when a pool reuses that backend. Ordinary OS users can generally lower priority but cannot restore it or set a negative nice value without extra capability. setpriority(integer) returns the raw success/error code instead of raising, so check it explicitly. The install script leaves execution available by default; revoke EXECUTE from application roles and expose only a tightly controlled administrative wrapper.