We use CiviCRM 5.21.2 with Drupal 7.69 and Webform together with webform_civicrm to provide petitions. The petitions ask for address and email. So every petition signature creates a contact with email and address. Additionally every contact gets a tag and if the email is confirmed with webform_confirm_email in some cases a group.

If the load on this webform submission gets higher we face deadlocks. Some of them seem to connected to group cache and acl cache and some to email or address inserts.

I saw that the tables email and address have triggers defined for insert, update and delete that write into the table contact. For example:

UPDATE civicrm_contact SET modified_date = CURRENT_TIMESTAMP WHERE id = NEW.contact_id;

Is it possible that these triggers have something to do with at least some of the deadlocks. Or that they at least make the chance higher to run into a deadlock?

Does anybody know, why they are there? Is it necessary to update the modified_date in the table contact immediately or would it be sufficient for the system if this is done by a cron job that runs once per day?

  • What version of MySQL/MariaDB are you using? There is some new-ish code in CiviCRM that takes advantage of locking features not available in older versions of the database software, which reduces deadlocks. Feb 23, 2020 at 20:11
  • It is Mariadb 10.3.22 Feb 24, 2020 at 10:32

1 Answer 1


Do you have some smart groups that are getting re-calculated on each submission perhaps?

Here's my answer to a more general question about smart groups and performance: How Smart Groups Work

  • I am afraid, that I understand too little about the processing of smart groups to answer this question. I can say, that I deleted as much smart groups as easy possible, but there are still 18 left. If this would help I could get rid of more with some effort. We use smart groups only as mailing lists for CiviMail. So I set smart group cache timeout to 0 and there is no scheduled job, that calculates smart group cache. I would only want a specific smart group calculated on mailing creation if it is used. Feb 24, 2020 at 15:43
  • Here's an easy experiment: try disabling all your smart groups (i.e. so they will be easy to re-enable). Smart group performance can be very counter-intuitive (I've added a link in my answer above to a previous spiel).
    – Alan Dixon
    Feb 25, 2020 at 16:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.