psql
DatabasesPackage: postgresql-client
PostgreSQL's interactive client. psql -c runs a query from a script; \l, \dt and \du answer the first three questions — which databases, which tables, which roles.
What its options do in the lessons
From the same glossary the lessons render under their commands, so the two cannot disagree.
psql -c- Runs a single query and exits, without opening an interactive session.
psql -d- Which database to connect to.
psql -U- The PostgreSQL role to connect as.
psql -h- The host. Naming it makes the connection go over TCP rather than the Unix socket — which changes the
pg_hba.confline that applies. psql -t- Output with no header and no footer: the rows alone.
psql -A- Unaligned output, easier for a script to split.
Lessons that teach it
- Becoming someone else, and which shell you getUsers, sudo and SSH access
- Restoring, and making the drill routineBackups and restores
- Roles and pg_hba.conf: why psql gets in and the application is refusedAdministering PostgreSQL: access, connections and growth
- A hundred connections, and the arithmetic that exceeds themAdministering PostgreSQL: access, connections and growth
- Reachable from elsewhere: four gates, four different refusalsAdministering PostgreSQL: access, connections and growth
- pg_stat_activity, and the transaction left openAdministering PostgreSQL: access, connections and growth
- Why a DELETE returns no spaceAdministering PostgreSQL: access, connections and growth
- pg_wal fills, and something is holding itAdministering PostgreSQL: access, connections and growth
- Finding the slow queries, not the slow momentAdministering PostgreSQL: access, connections and growth
- The index a query asked for, and the proof that it workedAdministering PostgreSQL: access, connections and growth
- shared_buffers and work_mem, without the folkloreAdministering PostgreSQL: access, connections and growth
- The five proofs: demonstrate, do not assertThe capstone: from repository to production
