Details
-
Type: Improvement
-
Status: Open
-
Priority: Important
-
Resolution: Unresolved
-
Affects Version/s: 4.7.15, 4.7.16, 4.7.17, 4.7.18, 4.7.19
-
Fix Version/s: 4.7.21
-
Component/s: Core CiviCRM
-
Versioning Impact:Patch (backwards-compatible bug fixes)
-
Documentation Required?:None
-
Funding Source:Contributed Code
-
Verified?:Yes
-
How it works currently:
-
How it should work:
-
Acceptance Criteria:Relationships table loads in under 30s for contacts with 20K to 30K relationships.
Description
Relationships tab for contacts with a lot of relationships (over 5000) take a lot of time to load. This is because the count of relationships is being done by fetching ALL records of relationships associated with the contact from the Database, putting them into an array, and then counting the number of elements in the array.
This is the problematic code:
https://github.com/civicrm/civicrm-core/blob/master/CRM/Contact/BAO/Relationship.php#L2077-L2083
This problem is similar to the one reported on CRM-20594.