I’ve been using Mermost 5.12.1 for more than a year, about 300+ active users. The size of the postgre DB is 41GB. Tell me how can I clean / shrink the database? Messages older than 3-4 months I do not need.
[root@mm ~]# du -sh /opt/mattermost/*
Hi there, @gvolshebnik
First things first, I would recommend you to consider backing up and upgrading Mattermost to the latest supported version, which is 5.24.2 to ensure that you are up to date with the latest features, security and bug fixes.
Moving back to the process of shrinking the database, the Data Retention Policy which is available for E20 offering is the best way to go for long term solution to ensure that you only keep what you need. May I know if it would be something that you would consider?
Thank you for your answer
E20 is not the best way out for us due to its high cost. The administrator’s manual says “do not touch the DB directly, use CLI”, but I did not find anything related to deleting messages in the CLI manual. Is there any other way?
You are welcome. So, there is no default way of deleting messages / posts using command line.
However, I came across an old post that explains the steps to delete old messages in this post.
I recommend you to attempt this on a staging / development instance first before applying them on the production to avoid unwanted data loss.