Page MenuHomePhabricator

Rationalise our mailing table data & related code so we can safely run civimail without insane queries
Closed, ResolvedPublic

Description

See comment in
https://phabricator.wikimedia.org/T335296#9159155

Upstream ref https://lab.civicrm.org/dev/core/-/issues/4567

I created an upstream issue https://lab.civicrm.org/dev/core/-/issues/4567 - but I think in the short term we need to rationalise our civicrm_mailing data

We have 22978433 records in civicrm_mailing_job that pre-date 2020 ....

We could

consolidate all our thank you mailing records in civicrm_mailing to 1 & update all the civicrm_mailing_job records
consolidate all our thank you mailing job records in civicrm_mailing_job to be just one job linked to the 1 mailing
update all the civicrm_mailing_event_queue records to link to this single job_id
not create new job ids as we thank - keep re-using
Doing the above should get the queries sane and allow the mailing dashboard to load & allow us to start querying stuff

It is further worth thinking about what we want from the older bounce records etc

My feeling is it might be worth creating activities for bounces less than x years old( or perhaps all 1.3m of them), and the unsubscribes & we should probably delete the delivereds & opens after just a month or 2 (AFAIK we have never looked at them)

  • We should probably NOT log the data for the activities to log_civicrm_activity for activity_type_id = 170 (Bounce) and have a retention plan to delete the data from 'details' after ? 3 months?

+------------------------------------------+-------------+

mailing_table number_rows
civicrm_mailing 7075
civicrm_mailing_job 50296940
civicrm_mailing_event_queue 50094686
civicrm_mailing_event_bounce 1305082
civicrm_mailing_event_confirm 0
civicrm_mailing_event_delivered 50070600
civicrm_mailing_event_forward 0
civicrm_mailing_event_opened 421457
civicrm_mailing_event_reply 402
civicrm_mailing_event_subscribe 0
civicrm_mailing_event_trackable_url_open 62816
civicrm_mailing_event_unsubscribe 9168

Event Timeline

Eileenmcnaughton renamed this task from Rationalise our mailing table data so we can safely run civimail without insane queries to Rationalise our mailing table data & related code so we can safely run civimail without insane queries.Sep 13 2023, 12:57 AM

Change 956984 had a related patch set uploaded (by Eileen; author: Eileen):

[wikimedia/fundraising/crm@master] Create thank_you mailing record on build site

https://gerrit.wikimedia.org/r/956984

Change 956987 had a related patch set uploaded (by Eileen; author: Eileen):

[wikimedia/fundraising/crm@master] Stop storing to MailingRecipients when creating mailings

https://gerrit.wikimedia.org/r/956987

Change 956988 had a related patch set uploaded (by Eileen; author: Eileen):

[wikimedia/fundraising/crm@master] Remove unused variable

https://gerrit.wikimedia.org/r/956988

Change 956991 had a related patch set uploaded (by Eileen; author: Eileen):

[wikimedia/fundraising/crm@master] Move failure threshold to Thank you form

https://gerrit.wikimedia.org/r/956991

Change 956993 had a related patch set uploaded (by Eileen; author: Eileen):

[wikimedia/fundraising/crm@master] Migrate another setting

https://gerrit.wikimedia.org/r/956993

Change 956987 merged by jenkins-bot:

[wikimedia/fundraising/crm@master] Stop storing to MailingRecipients when creating mailings

https://gerrit.wikimedia.org/r/956987

Change 956988 merged by jenkins-bot:

[wikimedia/fundraising/crm@master] Remove unused variable

https://gerrit.wikimedia.org/r/956988

Change 956991 merged by jenkins-bot:

[wikimedia/fundraising/crm@master] Move failure threshold to Thank you form

https://gerrit.wikimedia.org/r/956991

Change 957984 had a related patch set uploaded (by Ejegg; author: Ejegg):

[wikimedia/fundraising/crm@master] Remove last setting on legacy TY config form

https://gerrit.wikimedia.org/r/957984

Change 956984 abandoned by Ejegg:

[wikimedia/fundraising/crm@master] Create thank_you mailing record on build site

Reason:

Oops, I merged a duplicate / squashed version of this: I24dd5629df0191998025f4442e2489153968ac79

https://gerrit.wikimedia.org/r/956984

Change 957984 merged by jenkins-bot:

[wikimedia/fundraising/crm@master] Remove last setting on legacy TY config form

https://gerrit.wikimedia.org/r/957984

Change 958883 had a related patch set uploaded (by Eileen; author: Eileen):

[wikimedia/fundraising/crm@master] Fix verp to allow us to change job_id values

https://gerrit.wikimedia.org/r/958883

Change 958883 merged by jenkins-bot:

[wikimedia/fundraising/crm@master] Fix verp to allow us to change job_id values

https://gerrit.wikimedia.org/r/958883

Change 962728 had a related patch set uploaded (by Eileen; author: Eileen):

[wikimedia/fundraising/crm@master] Move the mailing_data update we started into the new upgrader method

https://gerrit.wikimedia.org/r/962728

Change 962733 had a related patch set uploaded (by Eileen; author: Eileen):

[wikimedia/fundraising/crm@master] Make our master mailing & mailing_job have id =1

https://gerrit.wikimedia.org/r/962733

Change 962734 had a related patch set uploaded (by Eileen; author: Eileen):

[wikimedia/fundraising/crm@master] Big but simple update to use one mailing_job for thank yous

https://gerrit.wikimedia.org/r/962734

Change 962750 had a related patch set uploaded (by Eileen; author: Eileen):

[wikimedia/fundraising/crm@master] Remove mailing jobs that have now been orphaned.

https://gerrit.wikimedia.org/r/962750

Change 962728 abandoned by Eileen:

[wikimedia/fundraising/crm@master] Move the mailing_data update we started into the new upgrader method

Reason:

https://gerrit.wikimedia.org/r/962728

Change 962734 abandoned by Eileen:

[wikimedia/fundraising/crm@master] Big but simple update to use one mailing_job for thank yous

Reason:

https://gerrit.wikimedia.org/r/962734

Change 962733 merged by jenkins-bot:

[wikimedia/fundraising/crm@master] Make our master mailing & mailing_job have id =1

https://gerrit.wikimedia.org/r/962733

XenoRyet set Final Story Points to 8.

Change 962750 abandoned by Eileen:

[wikimedia/fundraising/crm@master] WIP - Remove mailing jobs that have now been orphaned.

Reason:

https://gerrit.wikimedia.org/r/962750