PostgreSQL database taking almost twice as much storage as Heroku?


I was planning on migrating from Heroku to Render, so I set up a Postgres database to see how it looks. To my surprise, I almost hit the free & standard limit of 1GB, despite SELECT pg_size_pretty(pg_database_size('db_name')); saying it uses 504MB. The metrics tab on Render says it’s taking 947MB, despite it being an exact copy of my Heroku table that only consumes 576.8MB (and, again, pg_size_pretty saying it uses 504MB).

Any tips?

Same thing happened for me. I just restored a 16MB pg_dump to a brand new Postgres instance on Render. The SQL query above reports 104MB, while Render is reporting 228MB. I did notice on the brand new instance, before I pg_restored the backup file, it was showing around 50MB used. Still, that leaves 74MB (228 - 104 - 50) unaccounted for. Being a brand new database, I don’t imagine I’ve accumulated 74MB of logs in such short time, assuming maybe those are counted toward space.

Hey folks, I’m looking to get an explanation of the differences being seen here. I’ll post here when I have one.

1 Like

To clarify here - it’s the storage capacity of the Postgres instance itself, not the size of the database. It’s going to be made up of files required to run and persist the Postgres instance itself.

I hope that clears things up?

John B