su - postgres
show databases:
psql -l
or after connect without a database selected
\l
Connect to database:
psql [database] [username]
Show tables:
\d
Describe table:
\d+ table
Show rows per table:
SELECT schemaname,relname,n_live_tup
FROM pg_stat_user_tables
ORDER BY n_live_tup DESC;
Quit:
\q