DEV Community

Vivek Kumar Singh
Vivek Kumar Singh

Posted on

Managing connections in PostgreSQL

Commands to manage maximum number of connections in a PostgresSQL

Get max_connections value

show max_connections;

Updating max_connections value

alter system set max_connections = 1000;

and then restart the service

sudo service postgresql restart

Count number of used connections

SELECT sum(numbackends) FROM pg_stat_database;

List all connections

select * from pg_stat_activity;

Top comments (0)