Postgresql commands: ‘psql’ list commands

Here's a quick tabular list of Postgres commands related to listing information about a Postgres database. (Technically these are "psql commands", because you issue these commands from the psql command line program.)

These Postgres commands help you answer questions like "What tables are in this postgres database?", or "What databases do I have within Postgres?" (a handy question when it comes time for spring cleaning), and other questions. Other popular psql commands are related to permissions, indexes, views, and sequences.

psql commands

To issue any of these psql commands, first log into your database using the psql command, then issue any of the commands shown in the "Command" column below:

Listing Command Argument
Table, index, view, or sequence \d name
Tables \dt name
Indexes \di name
Sequences \ds name
Views \dv name
Permissions \dp or \z name
System tables \dS name
Large objects \dl name
Types \dT name
Functions \df name
Operators \do name
Aggregates \da name
Comments \dd name
Databases \l name