Skip to content

Latest commit

 

History

History
28 lines (21 loc) · 697 Bytes

SQL - PostgreSQL - Get Current DB Sessions.md

File metadata and controls

28 lines (21 loc) · 697 Bytes

SQL - PostgreSQL - Get Current DB Sessions

Source: https://www.postgresql.org/docs/current/monitoring-stats.html

-- Ref: https://www.postgresql.org/docs/current/monitoring-stats.html
-- Get current DB Sessions
SELECT count(*) as stat_count, state 
FROM pg_stat_activity 
WHERE "query"::text not ilike '%pg_stat_activity%' 
GROUP BY "state"

Appendix: Links

Backlinks:

list from [[SQL - PostgreSQL - Get Current DB Sessions]] AND -"Changelog"