Skip to content

Instantly share code, notes, and snippets.

@onpaws
Last active August 26, 2020 19:21
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 onpaws/42f2a7d2537e32fa857866be2a169798 to your computer and use it in GitHub Desktop.
Save onpaws/42f2a7d2537e32fa857866be2a169798 to your computer and use it in GitHub Desktop.
Postgres cheat sheet
# Start psql
psql "sslmode=require host=postgres-azure.postgres.database.azure.com user=admin@postgres-azure dbname=postgres"
# Connect to database
\c mydatabase
# Show databases
\l
# Show tables
\dt+
# Show users
\du+
# Disconnect sessions
SELECT pg_terminate_backend(pid);
# Show max connections
SHOW max_connections;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment