Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save RodrigoCMoraes/e5eedfb2862cda0e46b324901710f4c7 to your computer and use it in GitHub Desktop.
Save RodrigoCMoraes/e5eedfb2862cda0e46b324901710f4c7 to your computer and use it in GitHub Desktop.
Useful PostgreSQL Queries and Commands
-- all databases and their sizes
select * from pg_user;
-- Dump database on remote host to file
$ pg_dump -U username -h hostname databasename > dump.sql
-- Import dump into existing database
$ psql -d newdb -f dump.sql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment