Database
-- PostgreSQL and MySQL
SELECT version();
-- PostgreSQL
SELECT
datname,
usename,
query,
waiting,
state,
backend_start,
xact_start,
query_start,
state_Change,
client_addr || ':' || client_port AS client
FROM pg_stat_activity;
-- MySQL
SHOW PROCESSLIST;