facctcode = '233[深圳]' 可以使用索引,建立索引
facctattr like '投资%' 可以使用索引,建立索引
facctattr not like '%溢折价%' 无法使用索引
facctattr not like '%估值增值%' 无法使用索引
也就是说,可以对 列 facctcode 和 facctattr 分别建立索引
select * from table ---不要用* ,用列名,用哪列查那个
where facctcode = '233[深圳]' ---- 可以使用索引,建立索引
and facctattr like '投资%' ------使用索引,建立索引
and facctattr not like '%溢折价%'
and facctattr not like '%估值增值%'
---加时间条件,如果不是全表查询的话,加时间
and (time>'' and time<'' ) --最好是加括号,这样会先执行的
与其研究 LIKE '%' 的优化方法不如在可能的范围内调整你数据库结构。结构设计上的重大缺陷没办法用优化语句弥补