“Master these 10 psql commands and you’ll wonder how you ever lived without them.”
psql is PostgreSQL’s Swiss‑Army knife—fast, scriptable, everywhere. Its true power lives in meta‑commands (\ shortcuts). Learn these ten and jump from novice to power user.
- Everywhere — SSH into any server, psql is there.
- Scriptable — Pipe commands, integrate with CI/CD.
- Fast & reliable — No GUI latency, survives flaky links.
- Educational — Forces deeper understanding.
\l+ -- shows sizes
Use \l+ at login to spot huge DBs.
\c app_prod -- same user\c analytics dataeng host 5433 -- switch user / host / port
Hop between DBs without new terminals.
\dt -- current schema\dt+ -- add sizes & comments
\dt *.* -- all schemas
Instant data‑model overview; large tables jump out in \dt+.
.png)
