Skip to content

Instantly share code, notes, and snippets.

@magnobiet
Last active August 24, 2018 19:09
Show Gist options
  • Save magnobiet/95cb0d57e5d5013afceb43af043ee41e to your computer and use it in GitHub Desktop.
Save magnobiet/95cb0d57e5d5013afceb43af043ee41e to your computer and use it in GitHub Desktop.
Database
-- 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;
-- PostgreSQL and MySQL
SELECT version();
-- PostgreSQL
SELECT
schemaname,
relname,
n_live_tup
FROM pg_stat_user_tables
ORDER BY n_live_tup DESC;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment