This question is based on some testing I've done recently in order to better understand SQL indexing system.
Table with 500k entries, InnoDB engine
This is a simple select query on a
varchar field. The
name column is not indexed.
After indexing these are the results:
All good until this point. When I'm trying to place a wildcard at the beginning of the search key, even though the column is indexed, the result time is the one from the non-index case:
I'm wondering why is this happening? Is it because the index cannot be used any more? Is this solvable in any way? can I achieve a better search time even though I'm using
% both at the beginning and at the end of the search string?