-1

I have an app in Heroku which is reaching the 10K rows cap so I have to upgrade my Heroku DB, but I have a couple of doubts regarding this and I wan't to be completely sure about what I'm doing before doing anything to the production DB.

First of all I'm not 100% of this process and after a lot of time I found this link, so what I'm guessing is that I have to put my billing details in account settings, add a credit card and then after that I would be able to create a hobby-basic DB and automatically 9 dollars will be deducted from my credit card every month, am I right?

Regardin the process to change the DB of my app, the commands would be:

  1. First I would put my app in maintenance mode

heroku maintenance:on --app my_app_name

  1. Then I would make a DB backup and download it

heroku pg:backups:capture --app my_app_name

heroku pg:backups:download --app my_app_name

  1. I would also get my old DB name with

heroku pg:info --app my_app_name

  1. Then I create a new DB

heroku addons:create heroku-postgresql:hobby-basic --app my_app_name

Let's suppose HEROKU_POSTGRESQL_ROSE_URL is the name of thee new DB.

  1. And I copy all the record from my old DB to the new one

heroku pg:copy DATABASE_URL HEROKU_POSTGRESQL_ROSE_URL --app my_app_name

  1. To confirm I write the name of my app

my_app_name

  1. Then I designate my new DB as the prrimary DB

heroku pg:promote HEROKU_POSTGRESQL_ROSE_URL --app my_app_name

  1. Finally I turn off the maintenance mode

heroku maintenance:off --app my_app_name

  1. And then I delete my old DB

heroku addons:destroy old_db_name --app my_app_name

Is everything correct?

EDIT: So I made a test creating a hobby-dev DB, but at the end of the process this new DB had like 150 more rows (before it had like 820 rows and now it have like 970 rows), is this normal?

Also, is it normal that the size of the backup is like 200 KB, while in the Heroku interface, the DB had like 10 MB of size?

Patricio Sard
  • 2,092
  • 3
  • 22
  • 52

1 Answers1

1

I'll try to answer in the order of your questions.

  1. Yes, you'll need to add billing information to your account before you can provision paid addons like the hobby-basic database. Once your billing information is added you will be allowed to provision the database.

  2. The process you've detailed for the upgrade has some inefficiencies. In no particular order:

    • Don't wait until the middle of your upgrade process to create your new database. It can be done ahead of time.
    • Step 2 is unnecessary. There's no need to download a backup in the middle of this process.
    • In Step 5, you have ROSE database listed as the target but the new database may have a different color. This information is available from pg:info
    • Step 6 is also unnecessary. You can confirm in one line like so, heroku pg:copy DATABASE_URL HEROKU_POSTGRESQL_ROSE_URL --app my_app_name --confirm my_app_name
  3. It is normal for a backup dump file to be much smaller than the existing database. Dump files are compressed binary files that don't include table bloat or indexes. In some cases the Dump file might be 10% the size of the original database.

RangerRanger
  • 2,455
  • 2
  • 16
  • 36