Click here to Skip to main content
15,905,563 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Hi Friends,
I have a very simple query-
select COUNT(1) from [dbo].[table1] with (nolock)
When i run the query- sometime it takes 1 second and sometime 30 seconds. Can someone help me why the response time is sometime longer ans sometime good. What may be the possible reason- can please anyone help me?

1 solution

It could be for a number of reasons - some of which are discussed on this post - performance - SQL Server statements intermittently slow on SQL Server 2008 R2 - Database Administrators Stack Exchange[^]
It's for SQL 2008 but most, if not all, of the stuff applies to later versions too

If that doesn't help then there around 39k other things to look at[^]

We always used to "freeproccache" - SQL SERVER – Plan Cache – Retrieve and Remove – A Simple Script | Journey to SQL Authority with Pinal Dave[^]
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900