Details
-
Type: Improvement
-
Status: Done/Fixed
-
Priority: Major
-
Resolution: Fixed/Completed
-
Affects Version/s: 2.1
-
Fix Version/s: 2.1
-
Component/s: Core CiviCRM
-
Labels:None
Description
We are noticing in the slow query log that the LOWER operator is being used in MySQL:
SELECT count(DISTINCT contact_a.id) FROM civicrm_contact contact_a
LEFT JOIN civicrm_value_1_fieldsfromexistingdatabase2_5 ON civicrm_value_1_field
sfromexistingdatabase2_5.entity_id = contact_a.id WHERE ( LOWER(civicrm_value_
1_fieldsfromexistingdatabase2_5.housedistrict) = '98' ) AND ( 1 );
This is unnecessary because MySQL does case-insensitive matching. It is actually causes a negative performance impact because MySQL will not use any predefined indices if LOWER is specified.