Is there a way to configure PostgreSQL server instance to limit resources, e.g. work_mem or max_parallel_workers, by databases or schema? (or even limit a specific user)

To my knowledge, parameters from postgresql.conf affect the entire postmaster instance.

Background of this question is multi-tenancy based on DB schema and resource isolation.


You can set many parameters on the database or user level with


Connection limits can also be set on that level.

But a lot of things are global to the cluster (like shared_buffers), and a lot of resources (like CPU and I/O) cannot be limited at all.

I second the horse's comment to look at pg_cgroups, but I should mention that I am the author. That doesn't work on a database or user level though, but if you want to separate databases, it is always commendable to put them in different clusters anyway.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.