Created
May 2, 2016 17:22
-
-
Save icirellik/ec0362aa0ad7b254f6e291d412b0be50 to your computer and use it in GitHub Desktop.
PostgreSQL Commands
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Query a parameter | |
SHOW max_connections; | |
RESET max_connections; | |
SHOW ALL; | |
SELECT * FROM pg_settings; | |
SELECT * | |
FROM pg_settings | |
WHERE name = 'max_connections'; | |
-- Force drop db with active connections > 9.2 | |
SELECT pg_terminate_backend(pg_stat_activity.pid) | |
FROM pg_stat_activity | |
WHERE pg_stat_activity.datname = 'TARGET_DB' | |
AND pid <> pg_backend_pid(); | |
-- Show active connections | |
SELECT * FROM pg_stat_activity; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment