4 months ago
There seems to be an error with the display / calculation of the Volume Storage. The disk usage of the database should be around 1 GB not 38 GB
Pinned Solution
4 months ago
Yeah seems like something is off with your WAL archival settings for sure.
Before doing anything, I would take a backup with pg_dump on your local machine just to make sure your data is safe.
After that you can try these from a database console:
Check your WAL settings:
SHOW archive_mode;
SHOW archive_command;
SHOW wal_level;Set proper WAL archiving settings:
ALTER SYSTEM SET wal_keep_size = '1GB';
-- you can also set a custom wal_archive_command this way too; but do some resarch on what the best one would beDisable WAL archiving altogether
if you're already doing regularly scheduled backups, you realistically won't need WAL setup at all
ALTER SYSTEM SET archive_mode = off;If everything looks good, delete those old WAL files
just please make sure that your settings are a-okay and you have a backup that you can restore from if you have issues.
rm -rf /var/lib/postgresql/data/pgdata/wal_archive/*6 Replies
4 months ago
Hey there! We've found the following might help you get unblocked faster:
If you find the answer from one of these, please let us know by solving the thread!
4 months ago
Hello,
The volume's usage is correct: 35GB of data, with the rest being filesystem metadata.
I'll open this up to the community so they can help you clear this out.
Best,
Brody
Status changed to Awaiting User Response Railway • 4 months ago
4 months 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 • 4 months ago
4 months ago
How can the database dump be 159 MB big and the production database (from which this staging db has its data from) be 0.95 GB big, but this staging db is 35GB ? And out of nowhere, it was sitting at the exact same storage level for weeks and suddenly it uses 38GB, even as it was in sleep at the time.
paulf
How can the database dump be 159 MB big and the production database (from which this staging db has its data from) be 0.95 GB big, but this staging db is 35GB ? And out of nowhere, it was sitting at the exact same storage level for weeks and suddenly it uses 38GB, even as it was in sleep at the time.
4 months ago
Can you SSH into the service and try using the df and du commands to see where the big files are? It's possible that something went wrong and a bunch of transaction logs or something got persisted to disk in the volume mount directory causing your issues. It would be a rare case, but I've seen that happen in non-railway environments that utilize docker volumes before.
4 months ago
Hey mykal, thanks for the suggestion, I think you are right, it looks like there is an issue with the WAL archiving looking at this numbers:
876M /var/lib/postgresql/data/pgdata/base
1.1G /var/lib/postgresql/data/pgdata/pg_wal
33G /var/lib/postgresql/data/pgdata/wal_archive
35G /var/lib/postgresql/data/pgdata
Note, it's the default railway postgres image and config.
paulf
Hey mykal, thanks for the suggestion, I think you are right, it looks like there is an issue with the WAL archiving looking at this numbers:876M /var/lib/postgresql/data/pgdata/base1.1G /var/lib/postgresql/data/pgdata/pg_wal33G /var/lib/postgresql/data/pgdata/wal_archive35G /var/lib/postgresql/data/pgdataNote, it's the default railway postgres image and config.
4 months ago
Yeah seems like something is off with your WAL archival settings for sure.
Before doing anything, I would take a backup with pg_dump on your local machine just to make sure your data is safe.
After that you can try these from a database console:
Check your WAL settings:
SHOW archive_mode;
SHOW archive_command;
SHOW wal_level;Set proper WAL archiving settings:
ALTER SYSTEM SET wal_keep_size = '1GB';
-- you can also set a custom wal_archive_command this way too; but do some resarch on what the best one would beDisable WAL archiving altogether
if you're already doing regularly scheduled backups, you realistically won't need WAL setup at all
ALTER SYSTEM SET archive_mode = off;If everything looks good, delete those old WAL files
just please make sure that your settings are a-okay and you have a backup that you can restore from if you have issues.
rm -rf /var/lib/postgresql/data/pgdata/wal_archive/*Status changed to Solved noahd • 2 months ago