Last Updated: February 25, 2016
·
1.599K
· mdeiters

Fastest way to pull a heroku database down to local

Once you have a sizeable database, using heroku's db:pull command takes ages. I found running these four steps can pull down a large production database and restoring it locally in minutes

$ curl -o latest.dump `heroku pgbackups:url`
$ rake db:reset
$ pg_restore --verbose --clean --no-acl --no-owner -h localhost -U root -d YOUR_LOCAL_DB_NAME latest.dump
$ rm latest.dump