PostgresSQL Helper Command

Photo by Nam Anh on Unsplash

PostgresSQL Helper Command

List of command that might be useful

CommandDescription
\conninfoDisplays information about the current database connection.
\l or \listLists all databases in the PostgreSQL server.
\c [database_name]Connects to another database.
\dtLists all tables in the current database.
\dt *.*Lists all tables in all schemas of the current database.
\d [table_name]Describes the structure of a table.
\d+ [table_name]Provides more detailed information about a table.
\dnLists all schemas in the current database.
\duLists all users and roles with their permissions.
SELECT * FROM [table_name];Displays the content of a specified table.
SELECT current_user;Displays the name of the current user.
SELECT current_database();Displays the name of the current database.
\dvLists all views in the current database.
EXPLAIN [query];Shows the execution plan of a query.
\dfLists all functions in the current database.
\?Displays help for psql commands.
\hDisplays help for SQL commands.