dijous, 14 de juny de 2012

Quick steps with postgres for MySQL admins

Connect (really we are login with postgres user):
su - postgres

show databases:
psql -l
or after connect without a database selected

Connect to database:
psql [database] [username]

Show tables:

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;