# How many contacts added to segments and campaings

**URL:** <https://forum.mautic.org/t/how-many-contacts-added-to-segments-and-campaings/30966>\
**Category:** Product Support\
**Created:** [February 20, 2024, 8:42am UTC](https://forum.mautic.org/t/how-many-contacts-added-to-segments-and-campaings/30966 "2024-02-20T08:42:55Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![CarlJohan](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/carljohan/32/7016_2.png) [@CarlJohan](https://forum.mautic.org/u/CarlJohan)\
**Post date:** [February 20, 2024, 8:42am UTC](https://forum.mautic.org/t/how-many-contacts-added-to-segments-and-campaings/30966/1 "2024-02-20T08:42:55Z")

</div>

Im trying to understand how Mautic “moves” contacts to Campaings.

Is this understanding right:  
The “Segment” cronjobs runs and picks up to 300 contacts each time it is triggered?  
The “Campaings” cronjob runs and pikcs up to 100 contacts each time it is triggered?

---

<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:** [February 20, 2024, 10:14am UTC](https://forum.mautic.org/t/how-many-contacts-added-to-segments-and-campaings/30966/2 "2024-02-20T10:14:18Z")

</div>

Contacts are processed in batches of 300 records per batch. Obviously you can adjust the batch size.

---

<div class="post-metadata">

**Author:** ![CarlJohan](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/carljohan/32/7016_2.png) [@CarlJohan](https://forum.mautic.org/u/CarlJohan)\
**Post date:** [February 20, 2024, 10:37am UTC](https://forum.mautic.org/t/how-many-contacts-added-to-segments-and-campaings/30966/3 "2024-02-20T10:37:56Z")

</div>

Thanks @mzagmajster where do I change the bach sizes?

---

<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:** [February 20, 2024, 10:52am UTC](https://forum.mautic.org/t/how-many-contacts-added-to-segments-and-campaings/30966/4 "2024-02-20T10:52:27Z")

</div>

```auto
mautic:segments:update --batch-limit=300
mautic:campaigns:update --batch-limit=300

```

---

<div class="post-metadata">

**Author:** ![CarlJohan](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/carljohan/32/7016_2.png) [@CarlJohan](https://forum.mautic.org/u/CarlJohan)\
**Post date:** [February 20, 2024, 11:01am UTC](https://forum.mautic.org/t/how-many-contacts-added-to-segments-and-campaings/30966/5 "2024-02-20T11:01:02Z")

</div>

Ahh, so easy!

Many thanks @mzagmajster

---

<div class="post-metadata">

**Author:** ![CarlJohan](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/carljohan/32/7016_2.png) [@CarlJohan](https://forum.mautic.org/u/CarlJohan)\
**Post date:** [February 20, 2024, 11:51am UTC](https://forum.mautic.org/t/how-many-contacts-added-to-segments-and-campaings/30966/6 "2024-02-20T11:51:17Z")

</div>

FYI (see errors):

Rebuilding contacts for campaign 1  
Triggering events for campaign 1  
Triggering events for newly added contacts  
0 total contact(s) to be added in batches of 1  
0 total contact(s) to be removed in batches of 1

Rebuilding contacts for campaign 2  
0 total contact(s) to be added in batches of 1  
0 total events(s) to be processed in batches of 100 contacts

0 total events were executed  
0 total events were scheduled

Triggering scheduled events  
0 total contact(s) to be removed in batches of 1

Rebuilding contacts for campaign 3  
0 total events(s) to be processed in batches of 100 contacts

0 total events were executed  
0 total events were scheduled

Triggering events for inactive contacts

0 total events were executed  
0 total events were scheduled

0 total contact(s) to be added in batches of 1  
0 total contact(s) to be removed in batches of 1

Rebuilding contacts for campaign 6  
Triggering events for campaign 2  
Triggering events for newly added contacts  
0 total contact(s) to be added in batches of 1  
0 total events(s) to be processed in batches of 100 contacts

0 total events were executed  
0 total events were scheduled

Triggering scheduled events  
0 total contact(s) to be removed in batches of 1

X-Powered-By: PHP/7.4.33  
Content-type: text/html; charset=UTF-8

0 total events(s) to be processed in batches of 100 contacts

0 total events were executed  
0 total events were scheduled

Triggering events for inactive contacts

0 total events were executed  
0 total events were scheduled

Triggering events for campaign 3  
Triggering events for newly added contacts  
0 total events(s) to be processed in batches of 100 contacts

0 total events were executed  
0 total events were scheduled

Triggering scheduled events  
Rebuilding contacts for segment 1  
0 total events(s) to be processed in batches of 100 contacts

0 total events were executed  
0 total events were scheduled

Triggering events for inactive contacts

0 total events were executed  
0 total events were scheduled

Triggering events for campaign 6  
Triggering events for newly added contacts  
0 total events(s) to be processed in batches of 100 contacts

0 total events were executed  
0 total events were scheduled

Triggering scheduled events  
0 total events(s) to be processed in batches of 100 contacts

0 total events were executed  
0 total events were scheduled

Triggering events for inactive contacts

0 total events were executed  
0 total events were scheduled

X-Powered-By: PHP/7.4.33  
Content-type: text/html; charset=UTF-8

0 total contact(s) to be added in batches of 1  
0 total contact(s) to be removed in batches of 1  
0 contact(s) affected  
Rebuilding contacts for segment 2  
0 total contact(s) to be added in batches of 1  
0 total contact(s) to be removed in batches of 1  
0 contact(s) affected  
Rebuilding contacts for segment 3  
0 total contact(s) to be added in batches of 1  
0 total contact(s) to be removed in batches of 1  
0 contact(s) affected  
Rebuilding contacts for segment 6  
0 total contact(s) to be added in batches of 1  
0 total contact(s) to be removed in batches of 1  
0 contact(s) affected  
X-Powered-By: PHP/7.4.33  
Content-type: text/html; charset=UTF-8

[2024-02-20 11:48:04] Processing default mailer spool…  
0 emails sent  
X-Powered-By: PHP/7.4.33  
Content-type: text/html; charset=UTF-8

Rebuilding contacts for segment 1  
0 total contact(s) to be added in batches of 1  
0 total contact(s) to be removed in batches of 1  
Triggering events for campaign 1  
Triggering events for newly added contacts  
0 contact(s) affected  
Rebuilding contacts for segment 2  
0 total contact(s) to be added in batches of 1  
0 total contact(s) to be removed in batches of 1  
0 total events(s) to be processed in batches of 100 contacts

0 total events were executed  
0 total events were scheduled

Triggering scheduled events  
0 total events(s) to be processed in batches of 100 contacts

0 total events were executed  
0 total events were scheduled

Triggering events for inactive contacts

0 total events were executed  
0 total events were scheduled

Triggering events for campaign 2  
Triggering events for newly added contacts  
0 total events(s) to be processed in batches of 100 contacts

0 total events were executed  
0 total events were scheduled

Triggering scheduled events  
0 total events(s) to be processed in batches of 100 contacts

0 total events were executed  
0 total events were scheduled

Triggering events for inactive contacts

0 total events were executed  
0 total events were scheduled

0 contact(s) affected  
Rebuilding contacts for segment 3  
Triggering events for campaign 3  
Triggering events for newly added contacts  
0 total events(s) to be processed in batches of 100 contacts

0 total events were executed  
0 total events were scheduled

Triggering scheduled events  
0 total events(s) to be processed in batches of 100 contacts

0 total events were executed  
0 total events were scheduled

Triggering events for inactive contacts

0 total events were executed  
0 total events were scheduled

219 total contact(s) to be added in batches of 1  
0/219 [\>---------------------------] 0%Triggering events for campaign 6  
Triggering events for newly added contacts  
0 total events(s) to be processed in batches of 100 contacts

0 total events were executed  
0 total events were scheduled

Triggering scheduled events  
0 total events(s) to be processed in batches of 100 contacts

0 total events were executed  
0 total events were scheduled

Triggering events for inactive contacts

0 total events were executed  
0 total events were scheduled

X-Powered-By: PHP/7.4.33  
Content-type: text/html; charset=UTF-8

Rebuilding contacts for campaign 1  
0 total contact(s) to be added in batches of 1  
0 total contact(s) to be removed in batches of 1

Rebuilding contacts for campaign 2  
0 total contact(s) to be added in batches of 1  
0 total contact(s) to be removed in batches of 1

Rebuilding contacts for campaign 3  
0 total contact(s) to be added in batches of 1  
0 total contact(s) to be removed in batches of 1

Rebuilding contacts for campaign 6  
0 total contact(s) to be added in batches of 1  
0 total contact(s) to be removed in batches of 1

X-Powered-By: PHP/7.4.33  
Content-type: text/html; charset=UTF-8

1/219 [\>---------------------------] 0%  
2/219 [\>---------------------------] 0%  
3/219 [\>---------------------------] 1%  
4/219 [\>---------------------------] 1%  
5/219 [\>---------------------------] 2%  
6/219 [\>---------------------------] 2%  
7/219 [\>---------------------------] 3%  
8/219 [=\>--------------------------] 3%  
9/219 [=\>--------------------------] 4%  
10/219 [=\>--------------------------] 4%  
11/219 [=\>--------------------------] 5%  
12/219 [=\>--------------------------] 5%  
13/219 [=\>--------------------------] 5%  
14/219 [=\>--------------------------] 6%  
15/219 [=\>--------------------------] 6%  
16/219 [==\>-------------------------] 7%  
17/219 [==\>-------------------------] 7%  
18/219 [==\>-------------------------] 8%  
19/219 [==\>-------------------------] 8%  
20/219 [==\>-------------------------] 9%  
21/219 [==\>-------------------------] 9%  
22/219 [==\>-------------------------] 10%  
23/219 [==\>-------------------------] 10%  
24/219 [===\>------------------------] 10%  
25/219 [===\>------------------------] 11%  
26/219 [===\>------------------------] 11%  
27/219 [===\>------------------------] 12%  
28/219 [===\>------------------------] 12%  
29/219 [===\>------------------------] 13%  
30/219 [===\>------------------------] 13%  
31/219 [===\>------------------------] 14%  
32/219 [====\>-----------------------] 14%  
33/219 [====\>-----------------------] 15%  
34/219 [====\>-----------------------] 15%  
35/219 [====\>-----------------------] 15%  
36/219 [====\>-----------------------] 16%  
37/219 [====\>-----------------------] 16%  
38/219 [====\>-----------------------] 17%  
39/219 [====\>-----------------------] 17%  
40/219 [=====\>----------------------] 18%  
41/219 [=====\>----------------------] 18%  
42/219 [=====\>----------------------] 19%  
43/219 [=====\>----------------------] 19%  
44/219 [=====\>----------------------] 20%  
45/219 [=====\>----------------------] 20%  
46/219 [=====\>----------------------] 21%  
47/219 [======\>---------------------] 21%  
48/219 [======\>---------------------] 21%  
49/219 [======\>---------------------] 22%  
50/219 [======\>---------------------] 22%  
51/219 [======\>---------------------] 23%  
In AbstractMySQLDriver.php line 68:

An exception occurred while executing ‘INSERT INTO lead\_event\_log (user\_id,  
user\_name, bundle, object, action, object\_id, date\_added, properties, lead  
\_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)’ with params [null, “System”, "lead  
", “segment”, “added”, 3, “2024-02-20 11:48:58”, "{"object\_description":\   
“Test"}”, “28866”]:

SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update  
a child row: a foreign key constraint fails (`root2_test1`.`lead_event_log`  
, CONSTRAINT `FK_753AF2E55458D` FOREIGN KEY (`lead_id`) REFERENCES `leads`  
(`id`) ON DELETE CASCADE)

In Exception.php line 18:

SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update  
a child row: a foreign key constraint fails (`root2_test1`.`lead_event_log`  
, CONSTRAINT `FK_753AF2E55458D` FOREIGN KEY (`lead_id`) REFERENCES `leads`  
(`id`) ON DELETE CASCADE)

In PDOStatement.php line 117:

SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update  
a child row: a foreign key constraint fails (`root2_test1`.`lead_event_log`  
, CONSTRAINT `FK_753AF2E55458D` FOREIGN KEY (`lead_id`) REFERENCES `leads`  
(`id`) ON DELETE CASCADE)

mautic:segments:update [-b|–batch-limit [BATCH-LIMIT]] [-m|–max-contacts [MAX-CONTACTS]] [-i|–list-id [LIST-ID]] [-tm|–timing [TIMING]] [–bypass-locking] [-t|–timeout TIMEOUT] [-x|–lock\_mode LOCK\_MODE] [-f|–force] [-h|–help] [-q|–quiet] [-v|vv|vvv|–verbose] [-V|–version] [–ansi] [–no-ansi] [-n|–no-interaction] [-e|–env ENV] [–no-debug] [–]

X-Powered-By: PHP/7.4.33  
Content-type: text/html; charset=UTF-8

Triggering events for campaign 1  
Triggering events for newly added contacts  
0 total events(s) to be processed in batches of 100 contacts

0 total events were executed  
0 total events were scheduled

Triggering scheduled events  
0 total events(s) to be processed in batches of 100 contacts

0 total events were executed  
0 total events were scheduled

Triggering events for inactive contacts

0 total events were executed  
0 total events were scheduled

Triggering events for campaign 2  
Triggering events for newly added contacts  
0 total events(s) to be processed in batches of 100 contacts

0 total events were executed  
0 total events were scheduled

Triggering scheduled events  
0 total events(s) to be processed in batches of 100 contacts

0 total events were executed  
0 total events were scheduled

Triggering events for inactive contacts

0 total events were executed  
0 total events were scheduled

Triggering events for campaign 3  
Triggering events for newly added contacts  
0 total events(s) to be processed in batches of 100 contacts

0 total events were executed  
0 total events were scheduled

Triggering scheduled events  
0 total events(s) to be processed in batches of 100 contacts

0 total events were executed  
0 total events were scheduled

Triggering events for inactive contacts

0 total events were executed  
0 total events were scheduled

Triggering events for campaign 6  
Triggering events for newly added contacts  
0 total events(s) to be processed in batches of 100 contacts

0 total events were executed  
0 total events were scheduled

Triggering scheduled events  
0 total events(s) to be processed in batches of 100 contacts

0 total events were executed  
0 total events were scheduled

Triggering events for inactive contacts

0 total events were executed  
0 total events were scheduled

X-Powered-By: PHP/7.4.33  
Content-type: text/html; charset=UTF-8

Rebuilding contacts for segment 1  
0 total contact(s) to be added in batches of 1  
0 total contact(s) to be removed in batches of 1  
0 contact(s) affected  
Rebuilding contacts for segment 2  
0 total contact(s) to be added in batches of 1  
0 total contact(s) to be removed in batches of 1  
0 contact(s) affected  
Rebuilding contacts for segment 3  
0 total contact(s) to be added in batches of 1  
0 total contact(s) to be removed in batches of 1  
0 contact(s) affected  
Rebuilding contacts for segment 6  
0 total contact(s) to be added in batches of 1  
0 total contact(s) to be removed in batches of 1  
0 contact(s) affected  
X-Powered-By: PHP/7.4.33  
Content-type: text/html; charset=UTF-8

Rebuilding contacts for campaign 1  
0 total contact(s) to be added in batches of 1  
0 total contact(s) to be removed in batches of 1

Rebuilding contacts for campaign 2  
0 total contact(s) to be added in batches of 1  
0 total contact(s) to be removed in batches of 1

Rebuilding contacts for campaign 3  
0 total contact(s) to be added in batches of 1  
0 total contact(s) to be removed in batches of 1

Rebuilding contacts for campaign 6  
0 total contact(s) to be added in batches of 1  
0 total contact(s) to be removed in batches of 1

X-Powered-By: PHP/7.4.33  
Content-type: text/html; charset=UTF-8

---

<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:** [February 20, 2024, 1:12pm UTC](https://forum.mautic.org/t/how-many-contacts-added-to-segments-and-campaings/30966/7 "2024-02-20T13:12:23Z")

</div>

Inspection of the data processed would be required to see where in the data is the problem.

Basically for some reason mautic is trying to insert invalid data into database, why this is the case I am not sure.

Inspect the campaign where this happens and check the contacts that are effected by this. You can get more verbose output by adding -vvv at the end of mautic:segments:update command.
