Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Do not want memory cache

Author  Topic 

JamesT
Yak Posting Veteran

97 Posts

Posted - 2004-09-15 : 14:39:43
Ok, hopefully the Subject got your attention. This is kind of a strange question but one that I have to think others have encountered.

When you execute a query in Query Analyzer, let us say it takes 10 seconds to return. You execute it again right after getting the results and it is much faster. Why? Because of caching right? Well, what if I don't want it to do that? I had another developer ask me this question and it makes sense. I want it to behave like the worst-case scenario so I can plan for that situation. Is this absurd? Any ideas on how to force the database to retrieve the results from table rather than cached memory?

Any help is appreciated.

James

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-09-15 : 14:41:23
Run these:

DBCC FREEPROCCACHE
DBCC DROPCLEANBUFFERS

Tara
Go to Top of Page

JamesT
Yak Posting Veteran

97 Posts

Posted - 2004-09-15 : 14:49:39
Thanks!!
Go to Top of Page

eyechart
Master Smack Fu Yak Hacker

3575 Posts

Posted - 2004-09-15 : 15:59:00
yes, planning for that situation is absurd.

A better plan for that situation is to make sure you have plenty of buffer cache available. You can do this by proactively monitoring your system using SQL Profiler and finding queries that take too much memory, or run long.

You can also add memory to your box if no more tuning can be done, or if tuning cannot be done for whatever reason.



-ec
Go to Top of Page
   

- Advertisement -