Skip to content

Instantly share code, notes, and snippets.

View defrindr's full-sized avatar
👋
Hi there

Defri Indra Mahardika defrindr

👋
Hi there
View GitHub Profile
@defrindr
defrindr / postgres_queries_and_commands.sql
Created February 21, 2019 02:56 — forked from formigarafa/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (>= 9.2)
SELECT pid,
age(clock_timestamp(), query_start) AS age,
usename, state, query, waiting,
age(clock_timestamp(), xact_start) AS xact_age
FROM pg_stat_activity
WHERE state != 'idle'
AND query NOT ILIKE '%pg_stat_activity%'
ORDER BY age DESC;