Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

My SQL Server Machine has 6GB of RAM but the database size is 20GB. The Database is mainly an events log, clustered-indexed by time.

The clients are mostly interested in the latest data. They want it to be super fast when querying these latest data.

As SQL Server loads itself into server memory, is there a way to instruct SQL to pre-load only the latest data into memory?

share|improve this question
add comment

2 Answers

up vote 7 down vote accepted

Just issue a query that retrieves that data. But most likely, that will actually wind up doing more harm than good. You really just want to let the data fault in as it is needed.

share|improve this answer
    
True, that would do. BUt what if someone does an older data query? Wouldn't that wipe out all the earlier data in Server Memory? –  user1034912 Feb 14 '12 at 1:44
1  
@user1034912 If so, there's really no point in forcing it to pre-load the latest data, since the first old query would just cause it to be unloaded. The SQL server will do the right thing -- if it is beneficial to keep information in RAM, it will keep it in RAM. If it's better to use the RAM for short-term data, that's what it will do. Do you really think you no how to design an SQL server's use of memory better than the guys who designed your SQL server's use of memory? (If so, you should design your own SQL server.) –  David Schwartz Feb 14 '12 at 1:46
    
On top, it HAS to unload the other data - it needs to load the queries data into memory. If this turns an issue you have no other choice than being smarter in your database design (assuming you have an issu, for example a missing index forcing a table scan) or getting a little bit more memory. Hing on that - 32gb these days cost 300 USD. Modern ATC motherboards carry 64gb of those not too expensive modules. Really no sense to even discuss optimization with those prices around. –  TomTom Feb 14 '12 at 5:35
add comment

Tune the queries and the indexes so that everything performs in an optimal fashion. That would be the most important thing you can do. If you have optimized queries, you should be fine for memory management. If your queries are doing scans where they could do seeks, you're going to see memory get flushed on every query and performance will stink.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.