Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Script to find active sessions or connections in PostgreSQL

In this post, I am sharing a psql script to find a running or active sessions and connections of PostgreSQL.

This script is handy for PostgreSQL DBA.
I am using this same script for our productions PostgreSQL server.

Below is a script:
I filtered “idle connections”
SELECT 
 pid
 ,datname
 ,usename
 ,application_name
 ,client_hostname
 ,client_port
 ,backend_start
 ,query_start
 ,query 
FROM pg_stat_activity
WHERE state <> 'idle'
AND pid<>pg_backend_pid();

Comments

Popular posts from this blog

VMWARE WORKSTATION 3,4,5,6,7,8,9,10,11,12,14,15...etc LICENSE KEYS COLLECTION

How to find the server is whether standby (slave) or primary(master) in Postgresql replication ?

How to Configuration UDEV SCSI Rules In Oracle Linux 5, 6 and 7

Top 10 Highest Paying URL Shortener Companies - Best URL Shorteners To Earn Fast

Linux ctime,mtime,atime,cmin,amin,mmin