# Mautic:segments:update Question

**URL:** <https://forum.mautic.org/t/mauticupdate-question/22177>\
**Category:** Product Support\
**Created:** [December 28, 2021, 7:16pm UTC](https://forum.mautic.org/t/mauticupdate-question/22177 "2021-12-28T19:16:06Z")\
**Posts on this page:** 4\
**Page:** 1

<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:** [December 28, 2021, 7:16pm UTC](https://forum.mautic.org/t/mauticupdate-question/22177/1 "2021-12-28T19:16:06Z")

</div>

**Your software**  
My Mautic version is: 4.1.1  
My PHP version is: 7.4  
My Database type and version is: mariadb 10.3

**Your problem**  
My problem is:

We are running an extremely high traffic site with 1000+ visits per hour and are running into latency issues with segment update.

Example we have a campaign that is based on anonymous users hitting a certain page. This campaign is based off a segment that captures anonymous users. The problem is inside Mautic we also have 80+ segments some of which are a few hundred thousand users.

So what is happening is that this aparticular segment is actually taking around 10 minutes to update which rendors the focus item campaign useless.

Now I can go ahead and use Mautic:segments;update -i [segment id] to run specific segments that take very long only once a day for example, but this means that for my cronjob that is running every minute \* \* \* \* \* php /var/www/mautic/bin/console mautic:segments:update will update all segments, is there a way to do a "negative here " ?

I mean we are running a pretty strong server with 32GB RAM, 8 CPU, and still taking forever to update segments

---

<div class="post-metadata">

**Author:** ![mzagmajster](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/mzagmajster/32/687_2.png) [@mzagmajster](https://forum.mautic.org/u/mzagmajster)\
**Post date:** [December 28, 2021, 11:27pm UTC](https://forum.mautic.org/t/mauticupdate-question/22177/2 "2021-12-28T23:27:36Z")

</div>

Hi, not sure about available options in command, but one simple solution I can think of is to categorize segments by priority and then always use mautic:segments:update -i based on how freaquent specific category needs to be you then create cron job entry.

What I would do (assuming there is no suitable option with the command itself):

- Crreate a list of segments in Mautic and to each segment I would specify how often it needs to run (this can be csv file)
- Create a python/bash script that read this file, looks when segment update was last ran and then check it against how often ti needs to run (data in csv file)
- If it needs to run then within bash script I would run segments update for that specific segment
- If not you just skip it and move to next entry on the list

If there is no mechanism within the command (and I do not recall it at the moment) this might be a good feature request.

I hope its clear what I am tried to describe. Hope it helps.

Regards, M.

---

<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:** [December 29, 2021, 6:39am UTC](https://forum.mautic.org/t/mauticupdate-question/22177/3 "2021-12-29T06:39:23Z")

</div>

Yes, this is basically what I do within crontab itself, I land up having around 30 different lines for update segment. It would be much easier if there was a flag like to exclude certain segments rather than to just run a specific segment.  
Also my understanding of the -I flag is you can only allocate one segment to this,

---

<div class="post-metadata">

**Author:** ![mzagmajster](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/mzagmajster/32/687_2.png) [@mzagmajster](https://forum.mautic.org/u/mzagmajster)\
**Post date:** [December 29, 2021, 6:56am UTC](https://forum.mautic.org/t/mauticupdate-question/22177/4 "2021-12-29T06:56:58Z")

</div>

If we go even fruther we can do in a way that this “frequency for cronjob” is stored alongside each segment and then you only need to run mautic:segments:update and it would read config from database.

This way the whole setup for segments is in one place.
