DBAtlas · Database operations atlas

View connection count and connection limit

Oracle

SELECT COUNT(*) AS current_sessions FROM v$session WHERE type = 'USER';
SELECT name, value FROM v$parameter WHERE name IN ('processes','sessions');

The limits are the processes/sessions parameters. For utilization you can also check the resource_limit view.

PostgreSQL

SELECT count(*) FROM pg_stat_activity WHERE backend_type = 'client backend';
SHOW max_connections;

Because pg_stat_activity also includes background processes, only client connections (backend_type = 'client backend') are counted. superuser_reserved_connections slots are reserved for admins.

MySQL

SHOW STATUS LIKE 'Threads_connected';
SHOW VARIABLES LIKE 'max_connections';

The Max_used_connections status shows the peak.

SQL Server

SELECT COUNT(*) FROM sys.dm_exec_sessions WHERE is_user_process = 1;
SELECT @@MAX_CONNECTIONS AS configured_max;

@@MAX_CONNECTIONS is the theoretical ceiling; the practical limit depends on memory and worker threads.

MongoDB

db.serverStatus().connections

Returns the current, available and totalCreated fields. The limit is set by net.maxIncomingConnections.

Redis

INFO clients
CONFIG GET maxclients

connected_clients is the current count; maxclients is the configured ceiling (default 10000).

Open in DBAtlas →