Search code examples
databasepostgresqlmirth

Mirth database in Postgres causing storage problems


I have set up mirth on ubuntu server using Postgres database(on the same server). The problem is mirth messages takes up all the storage after some hours and mirth crashes. I want mirth to be continuously running on my server.

I've enabled message pruning but that only deletes the message data but does not free storage. Although 'Remove all messages' option in mirth launcher UI frees the storage. I've also tried to free the storage by truncating the tables, that works, but causes the error and no messages can be received further, and also WAL segments gets allocated.


Solution

  • After you prune the messages and then vacuum the tables, space should be freed up for internal reuse, but will probably not be handed back to the OS (for use in different files, or to show up in df). You can use pg_freespacemap or maybe pgstattuple to check if space is available for internal reuse, or pg_stat_activity or pg_stat_progress_vacuum to see if vacuuming is currently underway. Vacuuming should happen automatically after a large fraction of a table is deleted, unless you have gone out of your way to prevent it from happening.