pg_control_priority
Controls scheduling priorities (nice values) of PostgreSQL server processes.
pg_control_priority · Controls scheduling priorities (nice values) of PostgreSQL server processes.
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 100179 | pg_control_priority | pg_control_priority | 1.0 | ADMIN | PostgreSQL | C |
PostgreSQL · 10, 11, 12, 13, 14, 15, 16, 17, 18
Usage
Sources:
pg_control_priority 1.0 reads or raises the POSIX nice value of a PostgreSQL process. A larger numeric nice value means less CPU scheduling priority; this does not control query, lock, storage, or network priority.
Deprioritize the current test session
Run this in a disposable session because the backend remains deprioritized until it exits. The install SQL revokes public execution of both functions, so the calls require superuser access or an explicit grant.
Startup configuration
To apply the scheduling-priority setting consistently, preload the library and restart:
Caveats
- A PostgreSQL process can normally lower its own CPU priority but cannot raise it again without operating-system privilege. On common Unix systems the effective nice range ends at 19 even though the setting accepts 20.
- Supplying another PostgreSQL process identifier can affect client backends, auxiliary processes, or the postmaster when operating-system permissions allow it. Keep execution tightly restricted.
- The code uses PostgreSQL process checks and Unix scheduling APIs. It is not portable to Windows and must be built and tested for the exact PostgreSQL and operating-system target.