DB Statistic Queries

Show max or active connections to PostgreSQL, MySQL

DB Statistic Queries

PostgreSQL

The number of max connections

SHOW max_connections;

The number of currently open connections

SELECT sum(numbackends) FROM pg_stat_database;

MySQL

The number of max connections

SHOW GLOBAL VARIABLES LIKE 'max_connections';

The number of currently open connections

SHOW status WHERE `variable_name` = 'Threads_connected';