postgresql

info

psql postgres
psql db_name

\l  :: list databases
\l+
\d  :: show all tables, views, and sequences
\d+
\dt  :: tables
\dv  :: views

\c db_name  :: change db

\timing  :: timing on/off

select version();

\e  :: use an editor to type the command
\q  :: quit

help

\?
\h CREATE
\h CREATE INDEX

users

ALTER USER postgres WITH PASSWORD 'tmppassword';  :: change root pw
ALTER USER username WITH PASSWORD 'tmppassword';  :: change user pw

databases

CREATE DATABASE mydb WITH OWNER ramesh;
DROP DATABASE mydb;
SELECT pg_size_pretty(pg_database_size('mydatabasename')) As fulldbsize;