Skip to content

Instantly share code, notes, and snippets.

@hectorcanto
Last active August 13, 2019 16:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hectorcanto/c4adfbbcabbd5b221a6a36e877a0cebb to your computer and use it in GitHub Desktop.
Save hectorcanto/c4adfbbcabbd5b221a6a36e877a0cebb to your computer and use it in GitHub Desktop.
[postgres quick commands] some interesting commands for Postgres PSQL #db #postgres
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