Mysql Improve Search Performance with wildcards (%%)
Below is a query I use for searching a person by email SELECT * FROM phppos_customers JOIN phppos_people ON phppos_customers.person_id = phppos_people.person_id WHERE deleted = 0 AND email LIKE '%f%' ORDER BY email ASC Will adding an index on "email" speed up the query? No, because MySQL will not be able to utilize the index when you have a leading wildcard. If you changed your LIKE to 'f%', then it would be able to use the index. No, Mysql will not use the index because LIKE argument ( %f% ) starts with the wildcard character % . If it starts with a constant, index will be used. More info: 7