Sybase® SQL Server Performance and Tuning Guide
Chapter 9: Advanced Optimizing Techniques


Specifying the Cache Strategy

For queries that scan a table's data pages or the leaf level of a nonclustered index (covered queries), the SQL Server optimizer chooses one of two cache replacement strategies: the fetch-and-discard (MRU) strategy or the LRU strategy. See "Overview of Cache Strategies" for more information about these strategies.

The optimizer usually chooses fetch-and-discard (MRU) strategy for:

You can affect the cache strategy for objects:

If you specify MRU strategy and a page is already in the data cache, the page is placed at the MRU end of the cache, rather than at the wash marker.

Specifying the cache strategy only affects data pages and the leaf pages of indexes. Root and intermediate pages always use the LRU strategy.

Specifying Cache Strategy in select, delete, and update Statements

You can use lru or mru (fetch-and-discard) in a select, delete, or update command to specify the I/O size for the query:

select select_list
from table_name
    (index index_name prefetch size [lru|mru])
    [, table_name ...]
where ...
delete from table_name (index index_name 
                    prefetch size [lru|mru]) ... 
update table_name set col_name = value
    from table_name (index index_name
                    prefetch size [lru|mru]) ...

This query adds the LRU replacement strategy to the 16K I/O specification:

select au_lname, au_fname, phone
    from authors (index au_names prefetch 16 lru)

For more discussion of specifying a prefetch size, see "Specifying I/O Size in a Query".