select with no lock section
We have following SQL command in our application.
SELECT trackerid,taskid,action,sendto, sendtofullname, recfrom, actiontime
FROM [LO].[dbo].[TRACKER] WITH (NOLOCK)
where [EVENTRECORDID] = ? and ACTION in (1,4,5,15,4000,4200)
order by Actiontime
It ran some time and it was very quick, but last days it became extreme slowly. I changed it to
SELECT trackerid,taskid,action,sendto, sendto开发者_C百科fullname, recfrom, actiontime
FROM [LO].[dbo].[TRACKER]
where [EVENTRECORDID] = ? and ACTION in (1,4,5,15,4000,4200)
order by Actiontime
So I remove the section WITH (NOLOCK).
And it became fast again. It makes me any sense and i have no idea, why it has this behavior. I am also worried it became slow again. Could somebody explain it to me?
And DB server is MS SQL 2008
Thanks
I compared the execution plans, and they are the same.
One thing came to my mind. Every night we execute index reorganization (and once a week index rebuild). But after index reorganization we forgot update statistics. Could it have some connection?
精彩评论