Skip to content

Commit

Permalink
Merge pull request #12740 from twomice/lab367_a_to_z_query_performance
Browse files Browse the repository at this point in the history
dev/core#367: Query optimization for A-Z pager by adding indices to t…
  • Loading branch information
eileenmcnaughton authored Aug 28, 2018
2 parents 9eb4715 + 08fa90d commit cf5a823
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CRM/Contact/BAO/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -4208,6 +4208,12 @@ public function relationship(&$values) {
}
$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
Expand Down

0 comments on commit cf5a823

Please sign in to comment.