# Tabelle incoming\_emails belegt den meisten Speicherplatz in der Datenbank

**URL:** https://meta.discourse.org/t/table-incoming-emails-consuming-most-space-in-database/100610
**Category:** Self-hosting
**Tags:** server-resources
**Created:** [27. Oktober 2018 um 07:57 UTC](https://meta.discourse.org/t/table-incoming-emails-consuming-most-space-in-database/100610 "2018-10-27T07:57:38Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![adopilot](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/adopilot/32/105040_2.png) [@adopilot](https://meta.discourse.org/u/adopilot)
#### Post date: [27. Oktober 2018 um 07:57 UTC](https://meta.discourse.org/t/table-incoming-emails-consuming-most-space-in-database/100610/1 "2018-10-27T07:57:38Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [27. Oktober 2018 um 09:01 UTC](https://meta.discourse.org/t/table-incoming-emails-consuming-most-space-in-database/100610/2 "2018-10-27T09:01:41Z")

</div>

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

---

<div class="post-metadata">

### Author: ![adopilot](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/adopilot/32/105040_2.png) [@adopilot](https://meta.discourse.org/u/adopilot)
#### Post date: [27. Oktober 2018 um 09:04 UTC](https://meta.discourse.org/t/table-incoming-emails-consuming-most-space-in-database/100610/3 "2018-10-27T09:04:37Z")

</div>

My version is on [v2.2.0.beta3 +82](https://github.com/discourse/discourse/compare/dca830cb73371faca8e8497af13064a5bc92b52d...tests-passed)

---

<div class="post-metadata">

### Author: ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)
#### Post date: [30. Oktober 2018 um 00:10 UTC](https://meta.discourse.org/t/table-incoming-emails-consuming-most-space-in-database/100610/4 "2018-10-30T00:10:11Z")

</div>

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](https://global.discourse-cdn.com/meta/original/3X/6/6/6678a8e7e09123c073e9593c0ac919a0d2632101.png) 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.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [30. Oktober 2018 um 00:11 UTC](https://meta.discourse.org/t/table-incoming-emails-consuming-most-space-in-database/100610/5 "2018-10-30T00:11:25Z")

</div>

> [@gerhard](#):
>
> The `incoming_emails` table contains the raw source of all received emails. I guess you received a lot of emails that contained (large) attachments?

Whoa we never truncate this table.. ever? So we keep a raw original email version of all email posts _forever??_

---

<div class="post-metadata">

### Author: ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)
#### Post date: [30. Oktober 2018 um 00:14 UTC](https://meta.discourse.org/t/table-incoming-emails-consuming-most-space-in-database/100610/6 "2018-10-30T00:14:18Z")

</div>

Yes, exactly. Nothing gets deleted from that table.

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [1. August 2021 um 08:21 UTC](https://meta.discourse.org/t/table-incoming-emails-consuming-most-space-in-database/100610/10 "2021-08-01T08:21:44Z")

</div>


