Empty PostgreSQL service occupies over 1 GB of storage

okarmazin
PRO

9 months ago

I deployed a new PostgreSQL service on canvas, using the shortcut Create > Database > Add PostgreSQL. Inspecting its brand new volume, it reports 1.11 GB of storage used, even though it should only contain the initialized database data directory. I'm not well versed in PostgreSQL behavior, is this expected? Is it normal for empty PostgreSQL to occupy over a Gigabyte of storage? I understand that it initializes its data directory with some files, but 1 GB? That seems misreported.

6 Replies

I think that was misreported temporarily, because when I click into it, I don't see the storage being used?

Did you happen to remake the DB?


Status changed to Awaiting User Response Railway 9 months ago


okarmazin
PRO

9 months ago

Yes, I think I did delete the service and created a new one to check after writing this post. I found that 1.11 GB of storage is reported whenever a fresh PostgreSQL service is created. If you create your own, you should see the same numbers. The current service ID is 9dcc412f-5401-4c0e-b3bd-97e457424ea4 with volume `df26e874-6e74-4bf1-b9b7-ded3244a94cd`

Performing a volume wipe then lowers the reported volume disk usage to 363 MB (if I recall correctly), still not zero. After that if you restart the PostgreSQL service, it jumps back up to 1.11 GB. So PostgreSQL truly must occupy a Gigabyte in freshly initialized state. I'm just wondering why, and whether that's somehow tied to the 50GB max size of the DB volume. What led me to this question is the fact that I have a PostgreSQL service in the same project in development environment (`project/8093f881-dd83-4250-b725-dd87c94a218e/service/1510c8ba-a9c6-4a09-9129-d7d546dcbef7`) and that volume has a max size of 5 GB and the reported disk usage is only `303 MB` as opposed to the 1.11 GB in a fresh database in the production environment.


Status changed to Awaiting Railway Response Railway 9 months ago


So according to our infra team: each volume requires around 2.5-5% of reserved metadata size (reference: https://docs.railway.com/reference/volumes#pricing)

This is to disincentivize creating empty volumes, hope this helps.


Status changed to Awaiting User Response Railway 9 months ago


okarmazin
PRO

9 months ago

I see, I would never have guessed this is the small amount mentioned in that sentence. I suggest an improvement to the linked docs so that it reflects the information given in this thread. Consider:
If it really scales linearly with max volume size without limit, 2 - 5 % of wasted space is not exactly a small amount. The current wording sounds like a flat amount is reserved. How about replacing the term "small amount" in the docs with "2 - 5 percent of maximum volume size" or something like that? In any case, feel free to mark this as solved.


Status changed to Awaiting Railway Response Railway 9 months ago


Railway
BOT

9 months ago

An internal ticket has been attached to this thread. Updates will be relayed in this thread, so keep an eye out!

Status changed to In Progress Railway 9 months ago


9 months ago

Thank you for the feedback. I have passed it on to our team to review so we can improve clarity in the docs.


Status changed to Awaiting User Response Railway 9 months ago


Status changed to Solved christian 9 months ago


Railway
BOT

7 months ago

Update: An internal ticket linked to this thread has been changed to Completed.

Status changed to Awaiting Railway Response Railway 8 months ago


Railway
BOT

7 months ago

Update: An internal ticket linked to this thread has been changed to In Progress.