For specific applications, I have a set of queries that I run every time the database has been restarted for some reason (usually a server reboot). These are “simple” caching of SQL Server pages with a common core working set of data, so the application is not unusually slow the first time a user logs in after that.
One instance of the application works in a more complex location, where the SQL box has more RAM than the database size (4 GB in the machine, the database is under 1.5 GB at present and is unlikely to grow too much in relation to that in the near future). Is there a simple / easy way to tell SQL Server to leave and load everything into RAM?
This can be done using a script scan sysobjectsand sysindexesrun SELECT * FROM <table> WITH(INDEX(<index_name>)) ORDER BY <index_fields>for each key and index found, which should make each used page read at least once and so be in RAM, but is there a cleaner or more efficient way? All scheduled instances in which the database server is stopped are inoperative (all users have no more than one time zone, and unlike me, none of them work in stupid hours), so this process (until completion) slows down users more than the working one a set that does not load at all is not a problem.
source
share