postgres database size
lakshay-13
PROOP

a month ago

Another issue with the postgres database container is that it is taking a lot of disk space.

I changed my database schema and reduced the size to about 73mb.
And tried a lot of optimizations I could think of, but the volume still shows 1gb.

$10 Bounty

6 Replies

Railway
BOT

a month ago


lakshay-13
PROOP

a month ago

It is not completely normal to take 1 Gb before you give me this reply.

I started with a lower size as well, so there should be memory and disk cleanups going on to reduce the overall size. If my database is 73 mb. Considering walsize was 1 gb earlier it was acceptable for the total size to be 1gb, now I changed it to 256mb, so the overall size should also reduce


brody
EMPLOYEE

a month ago

This thread has been marked as public for community involvement, as it does not contain any sensitive or personal information. Any further activity in this thread will be visible to everyone.

Status changed to Open brody about 1 month ago


uxuz
MODERATOR

a month ago

Hey, I believe that this is a combination of the file system overhead, plus Postgres not freeing the space automatically when deleting records (altering schema). You can run VACUUM FULL;, but chances are, that it won't decrease the space by a lot, or not at all, as your WAL will increase.

With that being said, you can always deploy a new database, migrate the data over and delete the old one. I also deployed a new Postgres database on the pro plan with the volume size of 50GB (default of the pro plan) and it seems to be using 1GB of disk without anything in the database, meaning that most of it are part of the file system overhead.


uxuz

Hey, I believe that this is a combination of the file system overhead, plus Postgres not freeing the space automatically when deleting records (altering schema). You can run VACUUM FULL;, but chances are, that it won't decrease the space by a lot, or not at all, as your WAL will increase.With that being said, you can always deploy a new database, migrate the data over and delete the old one. I also deployed a new Postgres database on the pro plan with the volume size of 50GB (default of the pro plan) and it seems to be using 1GB of disk without anything in the database, meaning that most of it are part of the file system overhead.

lakshay-13
PROOP

a month ago

already did VACUUM and I removed indexes not needed and reduced wal size. Ig it just needed some time to relax it's back to 540mb which I expect the db to be around.

If you are getting 1 gb consider reducing wal size


Status changed to Solved noahd about 1 month ago


lakshay-13
PROOP

24 days ago

It says bounty awarded, who did you award the bounty too?


Status changed to Awaiting Railway Response Railway 24 days ago


lakshay-13

It says bounty awarded, who did you award the bounty too?

uxuz
MODERATOR

24 days ago

It was awarded to no one as you solved it yourself (the message with the green background is the solution and it is your own message above). The bounty awarded label in this case is just to mark this thread as solved.


Loading...