PostgreSQL 18 cheatsheet
PostgreSQL 18: Inspecting the database
9 common PostgreSQL 18 tasks.
List databases
Show every database on the server. Run \l inside psql or use the flag from the shell.
psql -U postgres -l
Toggle expanded output
Show each row as a vertical list, which is easier to read for wide tables.
\x
Check a database's size
Show the on-disk size of a database in a readable unit.
SELECT pg_size_pretty(pg_database_size('mydb'));