select * from table1 where (biaoti like '%兼%' or neirong like '%兼%') biaoti 是nvarchar
neirong 是ntext这是个站内搜索功能表中数据10万左右,查询非常的慢了
请问各位大虾 有办法优化吗?
neirong 是ntext这是个站内搜索功能表中数据10万左右,查询非常的慢了
请问各位大虾 有办法优化吗?
select top n * from table1 where (biaoti like '%兼%' or neirong like '%兼%')
行了。
呵呵,纯属歪招。
--------------------------
1:不能在NTEXT类型上建索引
2:字段 LIKE '%...%这样的语句本身也引用不了索引(即使字段有索引的话),除非是 LIKE '...%'
然后执行:
select * from table1 where contains(biaoti,'"兼"')
union all
select * from table1 where contains(neirong,'"兼"')
再把like 换用charindex
这样会快些
但是对于楼主的需要建个全文索引已经够用了
进行全文填充,然后查询即可hxd001_810(寒冬)写的麻烦了
select * from table1 where contains(*,'"兼"') 就可以
并不是所有 有“兼”字的都查询出来,“兼任”这个词语在全文查询中是查不出来的