Home Forums SQL Server 2008 T-SQL (SS2K8) Query spills to tempdb with correct cardinality estimates RE: Query spills to tempdb with correct cardinality estimates

  • martin catherall (10/30/2013)


    fair point Jeff, I used the term "spill to disk" to mean "spill to tempdb" - that was an error on my part.

    Let me re-phrase again 🙂

    Why can't SQL SERVER put aside enough memory for the sort and avoid the spill to tempdb,

    there seems to be an upper limit the memory that can be granted to a query.

    Thanks for correcting me.

    Cheers

    Martin.

    Someone even a little bit smarter than me on internals could do a much better job of explaining. I guess it's "by definition" that the sorts are designed to use TempDB so that SQL Server doesn't have to pre-allocate memory to that part of the query.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)