prioritize
prioritize
pg_prioritize : get and set the priority of PostgreSQL backends
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 5100 | prioritize | pg_prioritize | 1.0.4 | ADMIN | PostgreSQL | C |
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
--s-d-r | No | Yes | No | Yes | yes | no |
| Relationships | |
|---|---|
| See Also | pg_proctab pg_background system_stats pgnodemx pg_wait_sampling pg_repack pg_rewrite pg_squeeze |
no pg 14 on el9
Packages
| Type | Repo | Version | PG Major Compatibility | Package Pattern | Dependencies |
|---|---|---|---|---|---|
| EXT | PGDG | 1.0.4 | 18 17 16 15 14 | pg_prioritize | - |
| RPM | PGDG | 1.0.4 | 18 17 16 15 14 | pg_prioritize_$v | - |
| DEB | PGDG | 1.0.4 | 18 17 16 15 14 | postgresql-$v-prioritize | - |
| Linux / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
el8.x86_64 | PGDG 1.0.4 | PGDG 1.0.4 | PGDG 1.0.4 | PGDG 1.0.4 | PGDG 1.0.4 |
el8.aarch64 | PGDG 1.0.4 | PGDG 1.0.4 | PGDG 1.0.4 | PGDG 1.0.4 | PGDG 1.0.4 |
el9.x86_64 | PGDG 1.0.4 | PGDG 1.0.4 | PGDG 1.0.4 | PGDG 1.0.4 | MISS |
el9.aarch64 | PGDG 1.0.4 | PGDG 1.0.4 | PGDG 1.0.4 | PGDG 1.0.4 | PGDG 1.0.4 |
el10.x86_64 | PGDG 1.0.4 | PGDG 1.0.4 | PGDG 1.0.4 | PGDG 1.0.4 | PGDG 1.0.4 |
el10.aarch64 | PGDG 1.0.4 | PGDG 1.0.4 | PGDG 1.0.4 | PGDG 1.0.4 | PGDG 1.0.4 |
d12.x86_64 | PGDG 1.0.4 | PGDG 1.0.4 | PGDG 1.0.4 | PGDG 1.0.4 | PGDG 1.0.4 |
d12.aarch64 | PGDG 1.0.4 | PGDG 1.0.4 | PGDG 1.0.4 | PGDG 1.0.4 | PGDG 1.0.4 |
d13.x86_64 | PGDG 1.0.4 | PGDG 1.0.4 | PGDG 1.0.4 | PGDG 1.0.4 | PGDG 1.0.4 |
d13.aarch64 | PGDG 1.0.4 | PGDG 1.0.4 | PGDG 1.0.4 | PGDG 1.0.4 | PGDG 1.0.4 |
u22.x86_64 | PGDG 1.0.4 | PGDG 1.0.4 | PGDG 1.0.4 | PGDG 1.0.4 | PGDG 1.0.4 |
u22.aarch64 | PGDG 1.0.4 | PGDG 1.0.4 | PGDG 1.0.4 | PGDG 1.0.4 | PGDG 1.0.4 |
u24.x86_64 | PGDG 1.0.4 | PGDG 1.0.4 | PGDG 1.0.4 | PGDG 1.0.4 | PGDG 1.0.4 |
u24.aarch64 | PGDG 1.0.4 | PGDG 1.0.4 | PGDG 1.0.4 | PGDG 1.0.4 | PGDG 1.0.4 |
Source
Install
Make sure PGDG repo available:
pig repo add pgdg -u # add pgdg repo and update cacheInstall this extension with pig:
pig install pg_prioritize;# install via package name, for the active PG version pig install prioritize;# install by extension name, for the current active PG version pig install prioritize -v 18; # install for PG 18 pig install prioritize -v 17; # install for PG 17 pig install prioritize -v 16; # install for PG 16 pig install prioritize -v 15; # install for PG 15 pig install prioritize -v 14; # install for PG 14Create this extension with:
CREATE EXTENSION prioritize;Usage
The prioritize extension exposes getpriority() and setpriority() system calls for PostgreSQL backends, allowing you to renice backend processes from SQL.
Get Backend Priority
SELECT get_backend_priority(pg_backend_pid());Any user may query the priority of any backend.
Set Backend Priority
SELECT set_backend_priority(pg_backend_pid(), 10);Superusers can set the priority of any backend. Unprivileged users can only adjust backends with the same role.
Note: priority can only be raised (higher numeric value = lower OS priority). Only root can lower the numeric priority value, and PostgreSQL processes should not run as root.
Batch Operations
-- Increase priority of all current user's backends by 5 SELECT set_backend_priority(pid, get_backend_priority(pid) + 5) FROM pg_stat_activity WHERE usename = CURRENT_USER;Last updated on