qos
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 |
Packages
| Type | Repo | Version | PG Major Compatibility | Package Pattern | Dependencies |
|---|---|---|---|---|---|
| EXT | PIGSTY | 1.1.0 |
18 17 16 15 14 | pg_qos |
- |
| RPM | PIGSTY | 1.1.0 |
18 17 16 15 14 | pg_qos_$v |
- |
| DEB | PIGSTY | 1.1.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.1.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
Sources:
qos 1.1 (distribution 1.1.0) applies per-role and per-database resource limits on PostgreSQL 15+. Merge qos into shared_preload_libraries and restart before creating its SQL objects as an administrator. CPU affinity limits require Linux.
Configure Limits
Limit Semantics
qos.work_mem_limit caps effective work memory; qos.cpu_core_limit controls CPU affinity on Linux and limits parallel workers on other platforms. qos.max_concurrent_tx, qos.max_concurrent_select, qos.max_concurrent_update, qos.max_concurrent_delete and qos.max_concurrent_insert cap concurrent operations.
qos.max_tx_rate, qos.max_select_rate, qos.max_update_rate, qos.max_delete_rate and qos.max_insert_rate use count/window pairs such as 100/1s. The default -1 disables each rate limit. Windows range from 100 ms to one day. Rate and concurrency violations raise SQLSTATE 54000; clients should use the retry hint. The most restrictive applicable role/database setting wins, and rate pairs are compared by normalized rate.
Observability and Upgrade
qos_stat_rate exposes live windows; the other qos_stat views expose activity and counters. qos_prometheus_metrics() renders Prometheus exposition text. Counters reset at server restart. Version 1.1 replaces the old nonfunctional qos_get_stats() with these views.
Upgrading requires replacing the library and restarting PostgreSQL because the shared-memory layout changes, followed by ALTER EXTENSION qos UPDATE TO '1.1' in each database. New rate limits stay disabled until configured. These controls do not replace application admission limits or operating-system isolation.