开发者

MySql underscore wildcard optimization

开发者 https://www.devze.com 2023-01-27 23:00 出处:网络
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 optimizati

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消