Hi,
I have a query in MySQL (used in a stored procedure) which searches by name and another field. When I use different combinations of these search parameters, I get quick results (between 1 and 2s) but with some particular values, I get a query which takes 9s to return results on the production website. The following is what I got out of the EXPLAIN statement:
id, select_type, table, type, possible_keys, key, key_len, ref, rows, Extra
--------------------------------------------
1, SIMPLE, Names, ref, IX_Name, IX_Name, 17, const, 3173, Using where
Name is declared as varchar(40) and the other field is Unsigned smallint(6). I am using an index on the first 15 characters of the Name (IX_Name) which is being used in the query. I can see that the slow queries get a quite large number of rows to check in the "rows" column of the EXPLAIN output.
I am not sure what I can do to improve the performance. Is there anything noticeably wrong with the EXPLAIN output above?
Thanks, Tim