sql中查询时间问题
select isnull(sum(WG_RSNUM),0) as TotalRN,
isnull(round(sum(WG_AMOUNT),2),0) as TotalAmount
from View_SM_IN0
where WG_BILLTYPE='0'
AND
WG_VERIFYDATE >= '2012-07-01' 查询用了不到
1秒
select isnull(sum(WG_RSNUM),0) as TotalRN,
isnull(round(sum(WG_AMOUNT),2),0) as TotalAmount
from View_SM_IN0
where WG_BILLTYPE='0'
AND
WG_VERIFYDATE >= '2012-08-01'
查询却用了
9秒
------解决方案--------------------把两条语句反过来试一次,也许是缓存造成的.
------解决方案--------------------select isnull(sum(WG_RSNUM),0) as TotalRN,
isnull(round(sum(WG_AMOUNT),2),0) as TotalAmount
from View_SM_IN0
with(nolock)
where WG_BILLTYPE='0'
AND WG_VERIFYDATE >= '2012-08-01'
------解决方案--------------------数据没有变动吧,如果没有变动时间应该一样啊!
------解决方案--------------------这不科学啊 应该是缓存的问题
------解决方案--------------------是缓存的问题,貌似我以前也遇到过
------解决方案--------------------数据库缓存问题吧啊,你吧缓存清理了在执行下