Ian Parker shows off some meta-commands:
If you manage PostgreSQL from a terminal you already know
psql
, the interactive client that ships with every installation. Most developers use it for the basics—runningSELECT
statements, loading a.sql
file, maybe poking around with\dt
to see which tables exist.Beneath that familiar surface, though,
psql
hides a rich toolbox of meta-commands. These commands, all prefixed with a backslash, live inside the client. They’re not SQL, they’re shortcuts built intopsql
itself, and they can make everyday tasks faster and far less error-prone.
Read on for six of these, including examples like \watch
to view something with periodic refresh.