DEV Community

Dmitry Romanoff
Dmitry Romanoff

Posted on

How to limit the number of connections per DB in the PostgreSQL?

How to limit the number of connections per DB in the PostgreSQL?

alter database my_db connection limit 10;
Enter fullscreen mode Exit fullscreen mode

How to check the limit on the number of connections per DB in the PostgreSQL?

select datconnlimit from pg_database where datname='my_db';
Enter fullscreen mode Exit fullscreen mode

How to reset (i.e. return to default) the limit on the number of connections per DB in the PostgreSQL?

alter database my_db connection limit -1;
Enter fullscreen mode Exit fullscreen mode

Top comments (0)