psql is what you use when the fancy GUI tools decide to take a coffee break. It's PostgreSQL's command-line interface - ugly as hell but gets the job done when everything else fails.
The tool connects to PostgreSQL databases and lets you run SQL queries plus a bunch of meta-commands that start with backslashes. These meta-commands are lifesavers once you memorize them, but expect to Google "\dt vs \d+ vs \dn" about 47 times in your first week.
Why You'll End Up Using It
GUI tools like pgAdmin are pretty until they crash during a production incident and you're stuck with psql anyway. When your DataGrip license expires or TablePlus decides to freeze on a 10GB query result, psql is there looking smug as fuck.
Connection strings look like someone's password manager exploded:
psql \"postgresql://username:password@hostname:5432/database?sslmode=require\"
Save them in .pgpass or you'll never remember the syntax. Trust me on this one - I've wasted 2 hours debugging connection issues that turned out to be a missing ?
in the connection string.
The Meta-Commands That Actually Matter
Skip the 80+ meta-commands bullshit. Here are the 10 you'll actually use:
- `\l` - List databases (prepare for a wall of text)
- `\c database_name` - Switch databases (finally)
- `\dt` - Show tables (add
+
if you hate yourself and want to wait forever) - `\d table_name` - Describe table (the only way to see column types without writing SQL)
- `\x` - Toggle expanded mode (lifesaver for wide tables, annoying for small ones)
- `\q` - Quit (most important command)
Pro tip: \dt
without a pattern on a large database will list 400+ tables and you'll regret it. Use `\dt pattern*` unless you enjoy scrolling.
PostgreSQL 18 and What Actually Changed
With PostgreSQL 18 released on September 26, 2025, you get async I/O improvements that can speed things up 3x in certain scenarios. The UUIDv7 functions are actually useful unlike the marketing promises.
The big win is JSON_TABLE support - finally, you can query JSON without writing nested bullshit that breaks your brain. Plus logical replication improvements that might actually work without mysteriously failing at 2am.
But here's the thing - if you're still on PostgreSQL 12 because your ops team is afraid of upgrades, none of this matters. psql works the same frustrating way it always has, which is both a blessing and a curse.
Now, before you ask "why not just use mysql or another database CLI tool?" - let's see how psql stacks up against the competition.