Hello,
I would like to do case-insensitive comparisons so I use LOWER:
SELECT name FROM album WHERE LOWER(name) LIKE LOWER('a%') ORDER BY name LIMIT 100;
I have an index on name, unlike postgres mysql does not allow the lower-function specified at index-creation.
Explain gives me the following output:
mysql> explain SELECT name FROM lieferant WHERE LOWER(name) LIKE LOWER('a%') ORDER BY name LIMIT 100;
+----+-------------+-----------+-------+---------------+------------+---------+------+------+--------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-----------+-------+---------------+------------+---------+------+------+--------------------------+
| 1 | SIMPLE | album | index | NULL | test_index | 258 | NULL | 1053 | Using where; Using index |
+----+-------------+-----------+-------+---------------+------------+---------+------+------+--------------------------+
1 row in set (0.00 sec)
Do I need to change/optimize something to make this query as fast as possible?
Its used for auto-completition, and although the completition is done asynchrous it would be great if it could run quick.
Does this mean the index is used, is there anything I could do better for this query?
Thank you in advance, lg Clemens