I’m relatively new to this stuff, so forgive if the question is dump. Suppose a table with fields: id, str_field. values of str_field is something like “12:17:1246:90”. I want to get all rows where str_field contains e.g. “17”. To do this I’ll need to execute the following command
SELECT id FROM `table_name` WHERE INSTR(str_field, '17')>0
If there’s a large number of rows in the table the query can be slow. Here’s the question: if I’ll index str_field will it increase the spead of query execution?
Thank you in advance!
PS. In other terms I’m asking: does index increase the spead on for the queries like
SELECT * FROM `table_name` WHERE str_field='value'
?
UPD str_field contains only numbers separated by colons.
You could create a fulltext index and use the special MATCH functionality: http://dev.mysql.com/doc/refman/5.0/en/fulltext-search.html
Still, searching for values instead of expressions is much faster…