Page MenuHomePhabricator

Run away queries ->fail mail
Closed, ResolvedPublic

Description

Run away queries I just killed

CREATE TEMPORARY TABLE `civicrm_tmp_e_dflt_bf350900b11d1b9f9fd2bb9f84a91763` ENGINE=InnoDB COLLATE utf8_unicode_ci AS 
               SELECT con.id as id, con.contact_id, cso.id as filter_id, NULL as scredit_id
                 FROM civicrm_contribution con
            LEFT JOIN civicrm_contribution_soft cso ON con.id = cso.contribution_id
             GROUP BY id, contact_id, scredit_id, cso.id
            UNION ALL
               SELECT scredit.contribution_id as id, scredit.contact_id, scredit.id as filter_id, scredit.id as scredit_id
                 FROM civicrm_contribution_soft as scredit |    0.000 |

Need to check what @MDemosWMF was doing that caused these.... something to do with soft credits

Event Timeline

@Eileenmcnaughton sorry about that! Not sure what it was from looking at the above, can you translate for the non-technical? Definitely want to find out what it was so I don't trigger that again.

@MDemosWMF were you searching for soft credits? That is a bit of a problem at times

@Eileenmcnaughton Thinking back I could have been searching for DAF (donor advised fund) gifts if it was a soft credit. These types of gifts always have a soft credit of their financial institution or community fund. Should I avoid a search using soft credits all together or is there a way to safeguard while doing it? Thanks!

@MDemosWMF so there is a bit of an obscure safe guard - in that if you search before making any edits in that session it will probably go to the read only server. In general it would be best to be very conservative about any searches next week as the server will be crazy busy - but we can test your search out on staging & see if we can figure it out - can you recall what the criteria you were searching were?

@Eileenmcnaughton It might've been when I was looking for the $10K gift from T266617. I did "gift received Oct 27, gift amount 10,000, gift source Donor Advised Fund" and then where it said contributions or soft credits I tried "contributions and their related soft credits." Maybe this is what did it?

@MDemosWMF @RLewis - yes it's the 'contributions & their related soft credits' causing issues - what are you hoping to find with that option that you can't find without it?

@Eileenmcnaughton @RLewis Got it! As I searched for the gift and it wasn't popping up, I was trying a few different things and that was one of them. I will stay away from that in the future if it causes issues though. It shouldn't be necessary to use since I ended up finding the gift by going to CID 67 soft credits to find it. Glad to know what it was that did it!

OK - @RLewis also triggered the same query - so I wondered if there is something you are missing to help you

@Eileenmcnaughton sorry Eileen I was looking to find the names of our DAFs to provide a guide to Melanie and Engage staff and was looking under Soft Credits since we soft credit the financial institution from which we receive the DAF.

DStrine triaged this task as Medium priority.Dec 3 2020, 7:21 PM

Just ran across another one of these queries and I killed it off. It had caused the processing rate to drop to 0 while it held a lock.

| 1023089 | civicrm     | 10.64.40.109:40096 | civicrm  | Query       |    1421 | Copying to tmp table on disk                                          | /* User : 199 */CREATE TEMPORARY TABLE `civicrm_tmp_e_dflt_d110c4a47c48867e7c8b6d1d786ffbed` ENGINE=InnoDB COLLATE utf8_unicode_ci AS 
               SELECT con.id as id, con.contact_id, cso.id as filter_id, NULL as scredit_id
                 FROM civicrm_contribution con
            LEFT JOIN civicrm_contribution_soft cso ON con.id = cso.contribution_id
             GROUP BY id, contact_id, scredit_id, cso.id
            UNION ALL
               SELECT scredit.contribution_id as id, scredit.contact_id, scredit.id as filter_id, scredit.id as scredit_id
                 FROM civicrm_contribution_soft as scredit |    0.000 |

Change 645427 had a related patch set uploaded (by Eileen; owner: Eileen):
[wikimedia/fundraising/crm/civicrm@master] Avoid slow search

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

I just put up a patch to hard-block these queries with a message to log a phab explaining what the search goal is

Change 645427 merged by jenkins-bot:
[wikimedia/fundraising/crm/civicrm@master] Avoid slow search

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