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

Performance improvement in Tag.php

    Details

    • Type: Improvement
    • Status: Done/Fixed
    • Priority: Major
    • Resolution: Fixed/Completed
    • Affects Version/s: 3.3.6
    • Fix Version/s: 3.4.5
    • Component/s: Core CiviCRM
    • Labels:
      None

      Description

      The getTags() method in Tag.php uses recursion to build the tag hierarchy. The problem with this is that many unnecessary queries are generated on the civicrm_tag table as the function performs its recursion.

      We have implemented a new version of Tag.php which makes a single query to grab the contents of the civicrm_tag table, and we build the tree after iterating over the results.

      This cuts down on literally hundreds of queries per HTTP request for any tag-related operations.

      I am attaching the new version of Tag.php to this ticket.

      The full path to the file is custom/php/CRM/Core/BAO/Tag.php

        Attachments

        1. Tag.php
          15 kB
          Ken Zalewski
        2. Tag.php.patch
          4 kB
          Ken Zalewski

          Activity

            People

            • Assignee:
              kurund Kurund Jalmi
              Reporter:
              zalewski Ken Zalewski
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: