Created
January 12, 2012 19:09
-
-
Save owainlewis/1602439 to your computer and use it in GitHub Desktop.
Postgresql Cheat Sheet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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