Table incoming_emails consuming most space in database

My discource running out of disk space.
Searching for tables wich taking most of space in database I fund that table incoming_emails taking 9 GB of my disk space.Next one table is posts it’s take only 1 GB .
I did change setting delete email logs after days from 365 to 10 , I did trigger all jobs on sidekiq, I did vacuum database , but no release of disk space.
When I query table I see that there is emails from start of forum back in 2015.

Is there any other settings on discource I can tune up to get rid of incoming_emails;
Is there any other way to purge old incoming emails so we gain disk space.

4 Likes

I am pretty sure we automatically truncate this table… checking … yes, in Discourse 2.0 we changed retention from 1 year to 90 days.

1 Like

My version is on v2.2.0.beta3 +82

That’s the delete_email_logs_after_days setting which only applies to email logs.

The incoming_emails table contains the raw source of all received emails. I guess you received a lot of emails that contained (large) attachments?

If you are really low on disk space and you don’t care about the original emails (the data you see when you click on the envelope image in the right, top corner of posts created via email), you could delete them manually from the database. Maybe restrict it to the older or larger emails? Deleting them shouldn’t break any essential functionality. But, please make sure, that none of those emails are available via POP3 anymore, otherwise Discourse might pull them again, which could lead to duplicate posts.

4 Likes

Whoa we never truncate this table… ever? So we keep a raw original email version of all email posts forever??

1 Like

Yes, exactly. Nothing gets deleted from that table.

1 Like