Here are some PostgreSQL commands that are similar to
\dt, which is used to list all the tables in the current database:
\list: Lists all databases available on the PostgreSQL server.
\dt+: Lists all tables in the current database along with additional details like the number of rows, disk space usage, and comments on the tables.
\lS: Lists all schemas in the current database. Schemas are used to organize database objects, including tables.
\di+: Lists all indexes in the current database, including B-tree, GIN, GIST, and other types of indexes. The
\di+command provides additional details.
\dc+: Lists all privileges on tables and other objects in the current database. The
\dc+command provides additional details.
\df+: Lists all user-defined functions in the current database. The
\df+command provides additional details about the functions.
\du+: Lists all database users and their roles. The
\du+command provides additional details about user roles.
\d+ table_name: Provides detailed information about a specific table, including column names, data types, and constraints.
\d schema_name.*: Lists all tables and objects within a specific schema.
Access or Switch a Database:
List All Tables:
Describe All Tables:
Describe a Specific Table:
List All Schemas:
List All Views:
List All Functions:
List All Users:
Show Commands History:
Save Query’s Results to a Specific File:
Run psql Commands/queries From a Particular File:
Execute Previous Command:
Show Query Execution Time:
Get Output in HTML Format:
Align Columns Output:
Get All psql Commands:
These commands are useful for exploring and managing database objects in PostgreSQL. They provide information about tables, indexes, functions, and other database-related items, allowing you to interact with the database more efficiently and effectively.