This setup guide was created with the following components:
- DigitalOcean Droplet (Ubuntu 16.04.4 x64)
- Postgresql 9.5
- Nginx + Passenger
- Rails 5.2
- Ruby 2.4.1
ps -eo size,pid,user,command | awk '{ hr=$1/1024 ; printf("%13.6f Mb ",hr) } { for ( x=4 ; x<=NF ; x++ ) { printf("%s ",$x) } print "" }' | sort |
Apart from select statements you can use the following commands on psql prompt: | |
\d [NAME] describe table, index, sequence, or view | |
\d{t|i|s|v|S} [PATTERN] (add "+" for more detail) | |
list tables/indexes/sequences/views/system tables | |
\da [PATTERN] list aggregate functions | |
\db [PATTERN] list tablespaces (add "+" for more detail) | |
\dc [PATTERN] list conversions | |
\dC list casts | |
\dd [PATTERN] show comment for object |
createuser -R -S -L -D -I newusername; | |
psql -d postgres | |
postgres=# alter role newusername LOGIN; | |
postgres=# alter role newusername CREATEDB; | |
postgres=# alter role newusername SUPERUSER; # if needed |