Click here to Skip to main content
14,665,095 members
Rate this:
Please Sign up or sign in to 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

Rate this:
Please Sign up or sign in to vote.

Solution 1

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[^]

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

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100