• SQLSACT (9/25/2012)


    So if a query is submitted to SQL and the pages need to be brought into memory from disk and there is not enough memory to accomodate those pages, SQL pushes is into tempdb, right?

    No. If pages are needed in memory and there's not enough space in the buffer pool, other data pages will be removed from the buffer pool to make space. The algorithm that is used to determine which pages to evict is roughly an LRU-2, but there are complexities and cases where pages can be removed from cache immediately after they are read in and used.

    It is entirely possible, for a scan of a large table on a server with little memory, for the pages of that table to be read in, the rows on those pages processed by the query processor and then those pages removed from memory to make space for more pages from the same table.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass