Add Manual Segment Rebuild Controls with Status Information

Hello Mautic Team,

Description:
In Mautic 6, segment membership is currently rebuilt exclusively by a cron job (commonly every 5 minutes). This has several drawbacks:
* Users cannot control when the rebuild actually occurs, leading to unnecessary waiting.
* The time-based rebuilds run even when no one is actively using the system, wasting server and database resources.
* At scale, this inefficiency is amplified, increasing both system load and energy consumption unnecessarily.

Proposed Feature:
Introduce Manual Segment Rebuild Controls in the Mautic UI to give users greater flexibility, transparency, and system efficiency.

Key Enhancements:

1. Manual Rebuild Buttons:
* Add a “Rebuild Now” button to the segment detail view.
* Provide two options:
** Rebuild this segment only
** Rebuild all segments

2. Status & Visibility Enhancements:
* Display the timestamp of the last successful rebuild (per segment when viewing a segment, and global when rebuilding all).
* If another team member has already triggered a manual rebuild, display:
* The queued rebuild requests OR
* The next cron job run time
* Apply permissions so only authorised users can run manual rebuilds.

3. Efficiency & Scale Benefits:
* Improves system response times, especially for teams running Mautic at scale with many segments and contacts.
* Reduces wasted compute cycles by enabling targeted (per-segment) rebuilds instead of forcing full rebuilds every 5 minutes.
* Supports environmentally conscious usage by avoiding unnecessary resource consumption.

Example User Flow:
* A marketer edits a segment.
* Instead of waiting for the next cron job, they click “Rebuild This Segment Now”.
* Alternatively, a privileged marketer or admin can click “Rebuild All Segments” if a bulk refresh is required.
* The interface shows:
** Last rebuild completed: 4 minutes ago
** Next scheduled rebuild: in 1 minute OR Manual rebuild queued by \[User]

Impact:

This feature will:
* Give users control over when rebuilds occur.
* Provide transparency into the rebuild process.
* Reduce wasted server/database usage.
* Improve responsiveness and scalability for large instances.
* Support sustainable operation by minimizing unnecessary power consumption.

Thank you for considering this improvement and for your continued work on making Mautic more flexible and user-friendly.

Hello,

This feature request has received limited traction so far, and I would like to kindly ask the development team to reconsider its potential benefits—particularly in the context of increasingly complex segment membership rules which are now possible using third party plugins.

As segment logic becomes more advanced, the need for efficient and flexible rebuild mechanisms becomes even more important. An on-demand approach could significantly reduce unnecessary processing while improving responsiveness when updates are actually required.

I would also like to expand on the original proposal by suggesting the addition of API support.

API Support

Provide API endpoints to allow:

  • Rebuilding all segments

  • Rebuilding an individual segment

This would enable integrations and external systems to trigger segment updates programmatically, further enhancing flexibility and automation.

Thank you for your consideration.

Hi, why don’t you rebuild it every minute?

Hello joeyk,

Rethinking Segment Rebuilds in Mautic

Instead of relying on arbitrary, time-based cron schedules to rebuild segment membership, Mautic should prioritize keeping segments up to date only when it truly matters—at the moment they impact real activity. For example:

  • Sending emails

  • Running campaigns

  • Triggering automations

  • Viewing live data

There may be other scenarios, but the core idea is simple: segment accuracy should be event-driven, not blindly time-driven every minute.

The Problem with Frequent Rebuilds

When performing bulk operations—such as importing contacts, manually updating records, or modifying segment rules—Mautic may trigger segment rebuilds as frequently as every minute. This can quickly become inefficient and resource-intensive, especially during periods of heavy changes. Constant rebuilding in these situations doesn’t add value; it just creates unnecessary load.

A More Flexible Approach

A better approach would include:

  • Configurable rebuild intervals: While cron frequency can already be changed or disabled at the server level, it would be far more practical to expose this control directly within Mautic—ideally in the Segments UI—so users can adjust timing (e.g., every 30 minutes or hourly) without leaving the application.

  • Manual rebuild option: Provide a simple “Rebuild Now” button to let users trigger updates on demand when they need to verify results.

  • Temporary pause of automated rebuilds: Allow users to suspend rebuilds or extend the time between rebuilds during heavy imports or rule changes, rather than relying solely on external cron adjustments.

Toward Smarter, Event-Driven Rebuilds

Ideally, Mautic should evolve toward a smarter system where segments rebuild automatically only when necessary. Since Mautic already operates as a chain of events, messages, and triggers, segment updates could follow the same logic—executing dynamically when an action requires accurate data.

This would eliminate redundant processing while ensuring segments are always up to date when it actually counts.

Conclusion

Moving from rigid cron schedules to a more flexible, event-driven rebuild model—augmented with better in-app manual controls—would improve performance, reduce system strain, and give users greater control. Segment rebuilds should be timely, intentional, and efficient—not just frequent.

In the short term, the most practical improvement would be to introduce manual segment rebuild buttons, as suggested earlier. This would immediately give users better control during heavy changes or imports. More advanced, event-driven rebuild logic could then be introduced later as a longer-term enhancement.

Thanks.

@joeyk rebuilding every minute is not a great idea because it will jam the database. It can work for a low amount of contacts but I don’t see how at scale without upgrading the db every few thousands contacts

@andrew_c3 rebuilding segments before events is not great either though. This will lead to rebuild overlaps and thus to wasted resources as well.

If we would want to optimize segments we would need to rework them in such way that contact state change recalculates the contacts segment memberships opposed to calculating every membership periodically.

I think there are 2 aspects here:

  1. How many segments you have - if you have a LOT fo segments, it takes a lot of time to cycle through them
  2. How many changes you have between cycles. If you have a lot of changes they indeed, you should time your segment recreation. There are ways to manage this, there are scripts, where you can leave timing in the segment name (e.g. [10m] My Segment ) would activate the segment only every 10 min. Or maybe 1x a day, maybe 1x minute.

Hello,

Thanks for your input on this feature request. However, I have to disagree with both @joeyk and @dband.

In my experience using Mautic, having the option to manually trigger segment rebuilds—via a button or similar UI control—would be highly beneficial. It would give users more control over when rebuilds occur, rather than relying solely on cron-based automation. I hope the developers consider updating the UI to support this kind of functionality.

In the meantime, I’ve found a workable solution that fits my current needs. I’m also reviewing the segment rebuild code with the intention of rewriting or optimizing it to make the process more efficient, although that will take some time.

I’d also like to add that I don’t fully understand why some users dismiss feature requests like this. The addition of a manual rebuild option wouldn’t negatively impact those who prefer not to use it—they could simply ignore it. Meanwhile, others could find significant value in having that extra level of control.

That said, I appreciate you taking the time to share your perspective.

I am all for manual segment rebuilds. Actually the Mautic instance I am using, provided by Aivie, has this in place.

Hello @dband,

Nice bit of advertising on behalf of Aivie. Just be careful it doesn’t break the forum guidelines, otherwise the post might be deleted by the moderators.

However if Aivie has implemented such a good feature then suggesting this be added to core Mautic must be beneficial to everyone in the community.

I have a workaround for now.

Thanks.

We resolved this by developing a plugin please have a look at Run Manually Plugin – Plugins-Topchunks

Hello ravi_2002,

Shame you did not say you had a plugin back in Sept 25 when I first suggested the idea in the forum,

But I will take a look now.

Thanks

Hi, sorry for the late response—I wasn’t active earlier and only saw your complete post today.

I think everyone has different needs :slight_smile: And Mautic can make happy everyone. There are many solutions, here is a guide from 4 years ago.

Hello joeyk,

Thanks for posting your workaround solutions to this feature request, I will review it shortly.

Like I said to @ravi_2002 , I posted this feature request back in Sept 25, shame you did not post your solution back then as it would have saved me a lot of time.

However I have learnt a lot about the code while I developed my own workaround, but thanks anyway, its appreciated and others may benefit from you sharing this solution.

Thanks.