Skip to content

Instantly share code, notes, and snippets.

@owainlewis
Created January 12, 2012 19:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save owainlewis/1602439 to your computer and use it in GitHub Desktop.
Save owainlewis/1602439 to your computer and use it in GitHub Desktop.
Postgresql Cheat Sheet
Postgresql Cheat Sheet
===============================
start: psql -U username databasename
quit: \q
list all: \d
list tables: \dt
list all databases: \l
describe a table: \d tablename
count rows in table: select count(*) from tablename
EXPORT THE DATABASE
================================
pg_dump -U username -ci -F t -f filename.tar dbname
HEROKU BACKUP AND PUSH
===========================
http://devcenter.heroku.com/articles/taps
heroku db:push
heroku db:push postgres://postgres:mypass@remotehost/mydb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment