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

Slow query on contact tab -97% of query time is inspecting schema in logging BAO

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Minor
    • Resolution: Won't Fix
    • Affects Version/s: 3.4.3
    • Fix Version/s: 4.4.0
    • Component/s: Core CiviCRM
    • Labels:
      None

      Description

      When I go to civicrm/contact/view?reset=1&cid=2715 over 90% of the query time on contact tab is going into CRM_Logging_Schema::_CONSTRUCT even though logging is not on on the site

      From devel

      Executed 191 queries in 4287.7 milliseconds. Queries taking longer than 5 ms and queries executed more than once, are highlighted.
      Of the 191 queries

      4164.35 milliseconds
      SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'test_wcan' AND TABLE_TYPE = 'BASE TABLE' AND TABLE_NAME LIKE 'civicrm_%'

      From

      /**

      • Populate $this->tables and $this->logs with current db state.
        */
        function __construct()
        {
        require_once 'CRM/Contact/DAO/Contact.php';
        $dao = new CRM_Contact_DAO_Contact( );
        $civiDBName = $dao->_database;

      $dao = CRM_Core_DAO::executeQuery("
      SELECT TABLE_NAME
      FROM INFORMATION_SCHEMA.TABLES
      WHERE TABLE_SCHEMA = '{$civiDBName}'
      AND TABLE_TYPE = 'BASE TABLE'
      AND TABLE_NAME LIKE 'civicrm_%'
      ");

      There must be someway to cache / reduce the frequency of this?

        Attachments

          Activity

            People

            • Assignee:
              kurund Kurund Jalmi
              Reporter:
              eileen Eileen McNaughton
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: