Skip to main content
3 of 6
added 27 characters in body
Christia
  • 2.5k
  • 12
  • 32

Updating civicrm_mailing_event_queue and civicrm_mailing_recipients Tables in 4.7.8

Tomorrow, I will again begin the process of updating CiviCRM. I know that as the upgrade process is going through 4.7.8, it upgrades mailing foreign key constraints in civicrm_mailing_event_queue and civicrm_mailing_recipients tables, which have 2,230,662 and 3,025,260 rows, respectively. This causes this portion of the upgrade to be extremely long, and I had thought it stalled.

  1. What exactly are these tables for?
  2. How can I trim these tables down a bit?
  3. What are the ramifications to our constituent records of trimming it?

Describe civicrm_mailing_event_queue in mysql:

+------------+------------------+------+-----+---------+----------------+
| Field      | Type             | Null | Key | Default | Extra          |
+------------+------------------+------+-----+---------+----------------+
| id         | int(10) unsigned | NO   | PRI | NULL    | auto_increment |
| job_id     | int(10) unsigned | NO   | MUL | NULL    |                |
| email_id   | int(10) unsigned | YES  | MUL | NULL    |                |
| contact_id | int(10) unsigned | NO   | MUL | NULL    |                |
| hash       | varchar(255)     | NO   |     | NULL    |                |
| phone_id   | int(10) unsigned | YES  | MUL | NULL    |                |
+------------+------------------+------+-----+---------+----------------+

Here's an example of what one of the rows from above is storing:

mysql> SELECT * FROM civicrm_mailing_recipients LIMIT 10;
+-----+------------+------------+----------+----------+
| id  | mailing_id | contact_id | email_id | phone_id |
+-----+------------+------------+----------+----------+
| 560 |          7 |          3 |        3 |     NULL |
| 561 |          7 |      14561 |    14561 |     NULL |
| 562 |          7 |      31443 |    31443 |     NULL |
| 563 |          7 |      31481 |    31482 |     NULL |
| 565 |          8 |      14561 |    14561 |     NULL |
| 566 |          8 |      31534 |    31521 |     NULL |
| 569 |         10 |      14561 |    14561 |     NULL |
| 570 |         10 |      39403 |    37916 |     NULL |
| 572 |         11 |      14561 |    14561 |     NULL |
| 573 |         11 |      39403 |    37916 |     NULL |
+-----+------------+------------+----------+----------+

Describe civicrm_mailing_recipients in mysql:

+------------+------------------+------+-----+---------+----------------+
| Field      | Type             | Null | Key | Default | Extra          |
+------------+------------------+------+-----+---------+----------------+
| id         | int(10) unsigned | NO   | PRI | NULL    | auto_increment |
| mailing_id | int(10) unsigned | NO   | MUL | NULL    |                |
| contact_id | int(10) unsigned | NO   | MUL | NULL    |                |
| email_id   | int(10) unsigned | YES  | MUL | NULL    |                |
| phone_id   | int(10) unsigned | YES  | MUL | NULL    |                |
+------------+------------------+------+-----+---------+----------------+

Here's an example of what one of the rows from above is storing:

   mysql> SELECT * FROM civicrm_mailing_event_queue LIMIT 10;
+----+--------+----------+------------+------------------+----------+
| id | job_id | email_id | contact_id | hash             | phone_id |
+----+--------+----------+------------+------------------+----------+
|  8 |      9 |        3 |          3 | fda886fa89xxxxxx |     NULL |
|  9 |      9 |    14561 |      14561 | da71a735ffxxxxxx |     NULL |
| 10 |      9 |    31443 |      31443 | 3256b6d93axxxxxx |     NULL |
| 11 |      9 |    31482 |      31481 | 09c8d6d6ddxxxxxx |     NULL |
| 13 |     11 |    14561 |      14561 | 00e12468baxxxxxx |     NULL |
| 14 |     11 |    31521 |      31534 | 767409eb3fxxxxxx |     NULL |
| 15 |     14 |    14561 |      14561 | f5a36df7a3xxxxxx |     NULL |
| 16 |     14 |    37916 |      39403 | b6fee3b110xxxxxx |     NULL |
| 17 |     16 |    14561 |      14561 | f139097393xxxxxx |     NULL |
| 18 |     16 |    37916 |      39403 | 7a242aa0e5xxxxxx |     NULL |
+----+--------+----------+------------+------------------+----------+

Thanks in advance!

Christia
  • 2.5k
  • 12
  • 32