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

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.

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


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.


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 ?

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

1 Like

Hello @lm1,

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