Equivalent of PGAdmin III Server Status Activity Window in PGAdmin 4 v5
I came up with this query that returns the same columns as PGAdmin III Status Activity window but alas there is no color-coding of queries running longer than 5-10 seconds and no button that will terminate the query or the connection.
select pid as process_id,
application_name,
datname as Database,
usename as username,
client_addr as client_address,
backend_start as client_start,
query_start,
xact_start,
state,
state_change,
pg_blocking_pids(pid) AS blocked_by,
query
from pg_stat_activity
where state is not null
order by state,xact_start desc;
This query is based loosely on this post and this post