Question

I have application that makes different queries with different results so the caching in my case is harmful.

This means there is no common data that sql may benifit from it to fetch the result from memory directly instead of making hard disk access.

Was it helpful?

Solution

From your comments it sounds like you don't want SQL to use at much memory as you feel that it's pointless as any queries you run are effectively random.

Firstly, this memory is probably being used to store indexes and query plans, rather than the actual data you want returned, therefore you will probably find this cache is a lot more useful than you think.

Secondly, it is highly unlikely that sql using this amount of memory will cause any reduced performance on a truly random unseen query. If SQL Server needs to go to disk to get any information then the amount of memory its using is barely relevant.

However, it is possible to reduce the amount of memory that SQL Server uses. (I don't know where the option is in SQL 2008, but I assume its fairly similar) In Management Studio, right click on the Server and do Properties. Under there you will have a page for Memory. In here you can select the Minimum and Maximum values that SQL will use. This will effectively limit any caching sql does based upon your values, rather than the physical servers limitations.

I really don't think you will see any performance gains though. In my experience SQL is always best left doing it's own thing.

OTHER TIPS

Your question is wrong: caching means data is in memory, and avoids disk access.

In any event, SQL Server caching is not harmful. For the pedants, there are always exceptions but you'd have to have seriously screwed up code and configuration before it was.

Turning off (or attempting to turn off) SQL Server caching is thinking about the problem completely the wrong way. If the data is cached in your data layer tier, you should refresh it there. SQL Server will never serve up stale data.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top