← sources

Running multiple apps on one Postgres? I built an extension so one of them can't hog the whole server

source: reddit (reddit:selfhosted)published 2026-09-25 08:58ingested 2026-09-26 02:36

retained text

Hey everyone,

Like a lot of people here, I run a single PostgreSQL instance that several services share (Nextcloud, Gitea, Immich, whatever you have). It works great until one of them runs a heavy job and everything else crawls.

So I built **pg\_qos**, a PostgreSQL extension that lets you set limits per database or per user. You stay on one Postgres instance, but each app gets its own guardrails:

sql

    ALTER DATABASE immich SET qos.cpu_core_limit = '2';
    ALTER DATABASE nextcloud SET qos.max_concurrent_select = '20';
    ALTER ROLE gitea SET qos.work_mem_limit = '64MB';

What you can limit:

* CPU cores a database or user can use (Linux)
* Number of queries/transactions running at the same time
* Queries per second (e.g. `'100/1s'`)
* Memory per session (`work_mem`)

Changes apply to already-connected sessions, so no app restarts are needed. It supports PostgreSQL 15–18, has .deb/.rpm packages for Debian 13, Ubuntu 24.04 and RHEL 10, and is GPL-3.0.

Repo: [https://github.com/appstonia/pg\_qos](https://github.com/appstonia/pg_qos)

Would love to hear if this is useful for your setup or if something's missing.

document fetched 2026-09-26 00:30 · canonical https://reddit.com/r/selfhosted/comments/1wprb2u/running_multiple_apps_on_one_postgres_i_built_an