# Database Optimization

**URL:** <https://forum.mautic.org/t/database-optimization/21787>\
**Category:** Development\
**Tags:** volunteer, discussion, development\
**Created:** [November 26, 2021, 4:32pm UTC](https://forum.mautic.org/t/database-optimization/21787 "2021-11-26T16:32:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![a.bell](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/a.bell/32/2264_2.png) [@a.bell](https://forum.mautic.org/u/a.bell)\
**Post date:** [November 26, 2021, 4:32pm UTC](https://forum.mautic.org/t/database-optimization/21787/1 "2021-11-26T16:32:25Z")

</div>

Hello,

I’m wondering does anyone have any ideas on how to optimise the database to improve performance for mautic. I’m running an instance with 2 million+ leads. The cleanup cron runs once a week, but the email stats table is massive, and any campaigns / segments that query this often take a while or don’t finish before the cron tries to start again.

Is there anything that can be done to ‘archive’ old data or make it easier to run queries on segments / campaigns?

I’ve development experience and I’m happy to contribute to the project on github if there are any ideas, suggestions or open issues already for this?

Thanks

---

<div class="post-metadata">

**Author:** ![mikew](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/mikew/32/5156_2.png) [@mikew](https://forum.mautic.org/u/mikew)\
**Post date:** [November 29, 2021, 8:08am UTC](https://forum.mautic.org/t/database-optimization/21787/2 "2021-11-29T08:08:37Z")

</div>

very interested in seeing if there are any ideas / takers for this one. We are also experiencing speed issues with mautic on huge databases
