onprema

Basic psql commands

Command Description
\l List all databases
\c database_name Connect to a database
\dt List tables
\d List tables, views, and sequences
\di List indexes
\dn List schemas
\du List roles
\d+ table_name Describe a table (shows columns, indexes and data types)
\x Toggle expanded output. Super helpful when tables are very wide
\pset pager off Turn off the pager
\conninfo Show connection information

#postgresql #tools