Something is slow. Maybe a page takes forever to load, maybe a migration is hanging, maybe your Supabase dashboard just spins. You suspect a query is stuck somewhere in your database, but you can't see what's happening — Postgres doesn't exactly surface this on its own.
Turns out it does. You just need to ask.
Seeing what's running
Postgres keeps track of every active connection and what it's doing in a system view called pg_stat_activity. You can query it like any table:
SELECT pid, state, query, age(clock_timestamp(), query_start) AS duration







