-
Notifications
You must be signed in to change notification settings - Fork 3
PostgreSQL
Chunliang Lyu edited this page Aug 5, 2016
·
2 revisions
When it hangs, run the following
SELECT
pg_terminate_backend(pid)
FROM
pg_stat_activity
WHERE
-- don't kill my own connection!
pid <> pg_backend_pid()
-- don't kill the connections to other databases
AND datname = 'database_name'
;
Export all rows in a table to a CSV file: \copy stat_statlog to 'stat_statlog.csv' csv header