Postgres in a Hurry
Here are some common queries I use in Postgres.
View Current Query Activity
SELECT query, state, * FROM pg_stat_activity
Drop Existing Connections Except Yours (9.2+)
SELECT pg_terminate_backend(pg_stat_activity.pid)
FROM pg_stat_activity
WHERE pg_stat_activity.datname = 'TARGET_DB' -- ← change this to your DB
AND pid <> pg_backend_pid();