Skip to content

Instantly share code, notes, and snippets.

View bwicklund's full-sized avatar

Bryon Wicklund bwicklund

View GitHub Profile
@bwicklund
bwicklund / postgres_queries_and_commands.sql
Last active May 2, 2019 16:26 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- Show all running querys
SELECT user, pid, application_name, query, age(clock_timestamp(), query_start), state
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- kill running query
SELECT pg_cancel_backend(procpid);
-- kill idle query