Hey, I'm trying to optimize a SELECT char statement in mysql.
I am fully aware that using a LIKE '%text%' will NOT be optimizable, but can the underscore wildcard be used in any sort of optimization?
For instance I want something such as:
SELECT * FROM tbl WHERE col LIKE '_a_b_'
Is there a way to optimize this sort of query if I never u开发者_开发知识库se the % wildcard?
No. The only thing you can do in this case - is to create another field, that contains the same data without first letter and find WHERE col_cut LIKE 'a_b_'
. And maintain it with triggers.
精彩评论