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

Dmitry Romanoff - Mar 15 '23 - - Dev Community

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
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player