Skip to content

Instantly share code, notes, and snippets.

View sbussetti's full-sized avatar

Steve Bussetti sbussetti

  • New Jersey, USA
View GitHub Profile
@sbussetti
sbussetti / postgres_queries_and_commands.sql
Last active February 22, 2018 14:48 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- All commands assume 9.2 +
-- show running queries
SELECT pid, age(query_start, clock_timestamp()), state, waiting, usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>'
AND query NOT ILIKE '%pg_stat_activity%'
AND state != 'idle'
ORDER BY query_start desc;