Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

query caching?

Status
Not open for further replies.

karen4201

Programmer
Mar 9, 2006
37
US
This is a beginner question: It seems like SQL Server caches a query and its results. Is there a way to clear the cache so that I can test the run-time for a query? I'd like to see how long it would run for a new visitor to my database-driven web site. Then I could optimize the query.

Thanks in advance.
 
DBCC FREEPROCCACHE
DBCC DROPCLEANBUFFERS

From BOL:

Use DBCC FREEPROCCACHE to clear the procedure cache. Freeing the procedure cache would cause, for example, an ad-hoc SQL statement to be recompiled rather than reused from the cache.

Use DBCC DROPCLEANBUFFERS to test queries with a cold buffer cache without shutting down and restarting the server.



-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
Thanks.

I used:
CHECKPOINT
DBCC DROPCLEANBUFFERS

and got exactly what I was looking for.

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top