qos
QoS resource governor extension for PostgreSQL sessions and queries
pg_qos : QoS resource governor extension for PostgreSQL sessions and queries
Overview
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
| --sLd-- | No | Yes | Yes | Yes | no | no |
| Relationships | |
|---|---|
| See Also | plan_filter pg_kpart pg_readonly prioritize block_copy_command safeupdate pg_command_fw pg_strict pg_hint_plan |
requires shared_preload_libraries = ‘qos’; official support PG15+
Packages
| Type | Repo | Version | PG Major Compatibility | Package Pattern | Dependencies |
|---|---|---|---|---|---|
| EXT | PIGSTY | 1.0 |
18 17 16 15 14 | pg_qos |
- |
| RPM | PIGSTY | 1.0.0 |
18 17 16 15 14 | pg_qos_$v |
- |
| DEB | PIGSTY | 1.0.0 |
18 17 16 15 14 | postgresql-$v-qos |
- |
| Linux / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
| el8.x86_64 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | N/A |
| el8.aarch64 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | N/A |
| el9.x86_64 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | N/A |
| el9.aarch64 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | N/A |
| el10.x86_64 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | N/A |
| el10.aarch64 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | N/A |
| d12.x86_64 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | N/A |
| d12.aarch64 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | N/A |
| d13.x86_64 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | N/A |
| d13.aarch64 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | N/A |
| u22.x86_64 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | N/A |
| u22.aarch64 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | N/A |
| u24.x86_64 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | N/A |
| u24.aarch64 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | N/A |
| u26.x86_64 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | N/A |
| u26.aarch64 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | PIGSTY 1.0.0 | N/A |
Source
github.com/appstonia/pg_qos
pg_qos-1.0.0.tar.gz
Install
Make sure PGDG and PIGSTY repo available:
Install this extension with pig:
Config this extension to shared_preload_libraries:
Create this extension with:
Usage
qos: QoS resource governor extension for PostgreSQL sessions and queries
The qos extension provides Quality of Service resource governance for PostgreSQL, allowing administrators to set per-role and per-database limits on memory usage, CPU cores, and concurrent transactions/statements.
Configuration Parameters
| Parameter | Type | Description |
|---|---|---|
qos.work_mem_limit |
bytes | Maximum effective work_mem per session |
qos.cpu_core_limit |
integer | Maximum CPU cores available to a session |
qos.max_concurrent_tx |
integer | Maximum concurrent transactions |
qos.max_concurrent_select |
integer | Maximum concurrent SELECT statements |
qos.max_concurrent_update |
integer | Maximum concurrent UPDATE statements |
qos.max_concurrent_delete |
integer | Maximum concurrent DELETE statements |
qos.max_concurrent_insert |
integer | Maximum concurrent INSERT statements |
Per-Role Limits
Per-Database Limits
Combined Role + Database Limits
Enforcement Behavior
- Work memory: Intercepts
SET work_memand rejects values exceeding configured limits - CPU limiting (Linux only): Binds backend to N CPU cores via CPU affinity; on non-Linux platforms, limits parallel workers instead
- Concurrency: Executor hooks track active transactions/statements by type; violations block execution
Observability
The most restrictive combination of role-level and database-level settings takes effect. Requires shared_preload_libraries = 'qos' and PostgreSQL 15+.