This article is half-done without your Comment! *** Please share your thoughts via Comment ***
In this post, I am sharing one psql script to find a running or active session and connections of PostgreSQL.
This script is very useful for PostgreSQL DBA.
I am using this same script for our productions PostgreSQL server.
Below is a script and I have already filtered your running sessions and “idle connections”.
WHERE state <> 'idle'