Last active
August 26, 2020 19:21
-
-
Save onpaws/42f2a7d2537e32fa857866be2a169798 to your computer and use it in GitHub Desktop.
Postgres cheat sheet
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
# 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