dev/core#367: Query optimization for A-Z pager by adding indices to temp table.
authorAllen Shaw <allen@JoineryHQ.com>
Tue, 28 Aug 2018 16:55:43 +0000 (11:55 -0500)
committerAllen Shaw <allen@JoineryHQ.com>
Tue, 28 Aug 2018 16:55:43 +0000 (11:55 -0500)
CRM/Contact/BAO/Query.php

index 57643ede2677b99a55f8c1474a4c7f0d7dc59fdc..2b0b209fd208cc961e482e806649e8d6b680f8ed 100644 (file)
@@ -4208,6 +4208,12 @@ civicrm_relationship.start_date > {$today}
       }
       $sql = "
         CREATE TEMPORARY TABLE {$relationshipTempTable}
+          (
+            `contact_id` int(10) unsigned NOT NULL DEFAULT '0',
+            `contact_id_alt` int(10) unsigned NOT NULL DEFAULT '0',
+            KEY `contact_id` (`contact_id`),
+            KEY `contact_id_alt` (`contact_id_alt`)
+          )
           (SELECT contact_id_b as contact_id, contact_id_a as contact_id_alt, civicrm_relationship.id
             FROM civicrm_relationship
             INNER JOIN  civicrm_contact c ON civicrm_relationship.contact_id_a = c.id