As the number of mails in the database grows, the performance when writing (sending replies, adding notes) drops dramatically. it can currently take 30 seconds to send a reply on our deployment.
We initially believed it to be related to the sending of mail, but the problem persistst even after replacing the mailhost with maildrophost. The problem also appears when adding notes.
Since this happens unrelated to mail-sending and even when only adding notes, everything points towards either a table without proper indexes or a miswritten SQL query.