1、查询语句如下
EXPLAIN SELECT t.* from tbm_news_processing t where t.title like '%测试%' ;
EXPLAIN SELECT t.* from tbm_news_processing t where t.title regexp '.*测试.*' ;
SELECT t.* from tbm_news_processing t where t.title like '%测试%' ;
SELECT t.* from tbm_news_processing t where t.title regexp '.*测试.*' ;
2、监控耗时对比
3、开发中使用查询方案:
<if test="null != searchVo.title and searchVo.title !=''">
and p.title REGEXP CONCAT('.*',#{searchVo.title},'.*')
</if>
改造为:
<if test="null != searchVo.title and searchVo.title !=''">
and p.title Like CONCAT('%',#{searchVo.title},'%')
</if>