Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-21112

Optimize Relationship Count on Contact's Relationship Tab

    Details

    • Versioning Impact:
      Patch (backwards-compatible bug fixes)
    • Documentation Required?:
      None
    • Funding Source:
      Contributed Code
    • Verified?:
      Yes
    • How it works currently:
      Hide
      1. Add over 5000 relationships to a contact
      2. Enter the contact's Relationships Tab
      3. The relationships table takes a very long time to load.
      Show
      1. Add over 5000 relationships to a contact 2. Enter the contact's Relationships Tab 3. The relationships table takes a very long time to load.
    • How it should work:
      Hide
      1. Add over 5000 relationships to a contact
      2. Enter the contact's Relationships Tab
      3. The relationships table takes less than 20s to load.
      Show
      1. Add over 5000 relationships to a contact 2. Enter the contact's Relationships Tab 3. The relationships table takes less than 20s to load.
    • 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.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              Miya27 Camilo Rodriguez
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:

                Time Tracking

                Estimated:
                Original Estimate - 1 hour
                1h
                Remaining:
                Remaining Estimate - 1 hour
                1h
                Logged:
                Time Spent - Not Specified
                Not Specified