Performance - do not retrieve soft credits & pcps when not required
Per #2033 (closed) 3.5% (14 out of 393) of the queries I recorded when importing 7 contacts with 7 contributions were for retrieving pcp & soft credit information. However, this retrieved information is discarded unless the params hold the key 'pcp' or 'soft_credit' so we can simply bypass these queries almost all the time.
examples
timestamp | query | seconds | rows found | columns requested |
---|---|---|---|---|
15/09/20 2:54 | SELECT id FROM civicrm_contribution_soft WHERE contribution_id = 49769031 AND pcp_id IS NOT NULL | 0.000624 | 0 | 0 |
15/09/20 2:54 | SELECT id FROM civicrm_contribution_soft WHERE contribution_id = 49769031 AND pcp_id IS NULL | 0.000616 | 0 | 0 |