qos
Overview
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 5240 | qos | No | Yes | Yes | Yes | No | No | - |
| Related | 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+
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | PIGSTY | 1.0 | 1817161514 | pg_qos | - |
| RPM | PIGSTY | 1.0.0 | 1817161514 | pg_qos_$v | - |
| DEB | PIGSTY | 1.0.0 | 1817161514 | postgresql-$v-qos | - |
Build
You can build the RPM / DEB packages for pg_qos using pig build:
Install
You can install pg_qos directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:
Install the extension using pig or apt/yum/dnf:
Preload:
Create Extension:
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+.
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)