Last active
August 13, 2019 16:57
-
-
Save hectorcanto/c4adfbbcabbd5b221a6a36e877a0cebb to your computer and use it in GitHub Desktop.
[postgres quick commands] some interesting commands for Postgres PSQL #db #postgres
This file contains 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
ALTER SEQUENCE id_seq_player RENAME TO player_id_seq; # rename a sequence artifact | |
ALTER SEQUENCE model_id_seq RESTART WITH 1; # there is also select setval(); | |
# Remove connections from a certain DB, useful for ill-finished test runs. | |
SELECT pid, pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname='DB_NAME'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment