下面5个SQL查询效率差异很多,BusinessIndex表中有300万条记录,
其中DatAuthor建立有索引,其它字段没有索引。
哪个高手可以分析下什么原因? 非常感谢!
SELECT strCode, strIndex from BusinessIndex where 1=1 and UserOrgID=1 and ( BusinessIndex.strIndex like '%热水器%')
--查询4s
SELECT strAuthor, strIndex from BusinessIndex where 1=1 and UserOrgID=1 and ( BusinessIndex.strIndex like '%热水器%')
--查询4s
SELECT strCode,strAuthor, strIndex from BusinessIndex where 1=1 and UserOrgID=1 and ( BusinessIndex.strIndex like '%热水器%')
--查询39s
SELECT ROW_NUMBER() OVER (order by datAuthor Desc ) as hibernate_row_nr,
strCode, strAuthor,strIndex from BusinessIndex where 1=1 and UserOrgID=1 and ( BusinessIndex.strIndex like '%热水器%')
--查询4s
SELECT top 20 ROW_NUMBER() OVER (order by datAuthor Desc ) as hibernate_row_nr,
strCode, strAuthor,strIndex from BusinessIndex where 1=1 and UserOrgID=1 and ( BusinessIndex.strIndex like '%热水器%')
--查询40s