PostgreSQL Commands
Connect to DB
1 | psql -U userXXX -d dbXXX |
DB operations
List all DBs
1
\l
List all tables
1
\dt
List all users
1
\du
List table info.
1
\d table_name
Quit
1
\q
Backup & restore
Backup
1
pg_dump -U userXXX dbXXX | gzip > backup.gz
Restore
1
pg_restore --clean -U userXXX -d dbXXX backup
Reference
Comment