# Possibilities to „clean up“ mautic to make it run faster?

**URL:** <https://forum.mautic.org/t/possibilities-to-clean-up-mautic-to-make-it-run-faster/17656>\
**Category:** Product Support\
**Created:** [January 4, 2021, 8:36am UTC](https://forum.mautic.org/t/possibilities-to-clean-up-mautic-to-make-it-run-faster/17656 "2021-01-04T08:36:56Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![lm1](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/lm1/32/1477_2.png) [@lm1](https://forum.mautic.org/u/lm1)\
**Post date:** [January 4, 2021, 8:36am UTC](https://forum.mautic.org/t/possibilities-to-clean-up-mautic-to-make-it-run-faster/17656/1 "2021-01-04T08:36:56Z")

</div>

**Your software**  
My Mautic version is: 2.16.0  
My PHP version is: 7.0.33-34

**Your problem**  
My problem is:  
Our Mautic is very slow. Especially updating segments takes a very long time.

We currently have the problem that the following cronjob unfortunately takes longer and longer.

app/console mautic:segments:update

We see in SQL that an SQL query sometimes takes 1-2 hours to run.

**Hence the question whether Mautic can clean up/optimize something in the database.**

Steps I have tried to fix the problem:  
We have already checked/completed the following on the server side.

- The server has enough CPU, RAM and hard disk I/O.
- Optimization on the part of MySQL.

---

<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:** [January 4, 2021, 9:55am UTC](https://forum.mautic.org/t/possibilities-to-clean-up-mautic-to-make-it-run-faster/17656/2 "2021-01-04T09:55:19Z")

</div>

Hi @lm1

First I would recommend upgrading to the latest version of Mautic.

There is the possibility to clean up the DB a bit with a cronjob that cleans events etc… but I do not think this will solve your problem.

It seems that maybe you have pretty intricate filters in your segments and maybe a number of different segments, what I would suggest is not to update all your segments all the time. Rather figure out which segments need to be updated daily, which ones every x minutes etc… and add in cronjob to only update specific segments at specific times. This can be done with adding -i [segment\_id] at the end of the update:segment cronjob.

Other ways are outside of Mautic scope and would require optimizing database with external tools maybe

---

<div class="post-metadata">

**Author:** ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)\
**Post date:** [January 4, 2021, 10:27am UTC](https://forum.mautic.org/t/possibilities-to-clean-up-mautic-to-make-it-run-faster/17656/3 "2021-01-04T10:27:17Z")

</div>

Hi, you need to be efficient when you create your mautic segments.  
Log in to SSH, and check which segment update takes long time.  
Disable the ones, that pull down your instance.  
For example: if you have page visit based segments, they can be a real problem once you have many visitors. Make sure you are not running redundant segments.

---

<div class="post-metadata">

**Author:** ![namratasaun](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/namratasaun/32/2801_2.png) [@namratasaun](https://forum.mautic.org/u/namratasaun)\
**Post date:** [February 14, 2021, 9:33am UTC](https://forum.mautic.org/t/possibilities-to-clean-up-mautic-to-make-it-run-faster/17656/4 "2021-02-14T09:33:06Z")

</div>

yes exactly. I checked this and the visited url segment is taking the longest. it feels like it is almost stuck.  
is there any way we can fasten it @joeyk ?

---

<div class="post-metadata">

**Author:** ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)\
**Post date:** [February 15, 2021, 4:07pm UTC](https://forum.mautic.org/t/possibilities-to-clean-up-mautic-to-make-it-run-faster/17656/5 "2021-02-15T16:07:06Z")

</div>

Hi, no, that is the speed you can expect. Try not to use it too much.

---

<div class="post-metadata">

**Author:** ![pierre\_a](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/pierre_a/32/7031_2.png) [@pierre\_a](https://forum.mautic.org/u/pierre_a)\
**Post date:** [April 21, 2022, 5:21pm UTC](https://forum.mautic.org/t/possibilities-to-clean-up-mautic-to-make-it-run-faster/17656/6 "2022-04-21T17:21:20Z")

</div>

Hello @lm1,

Were you able to test the proposed solutions (starting with the latest version of Mautic)?  
Does this answer your question?

Pierre
