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

  • Jeff Moden (10/30/2013)


    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.

    I like the posts from Paul White and Joe Sack

    Paul White - Advanced TSQL Tuning: Why Internals Knowledge Matters

    Joe Sack - Memory Grant Execution Plan Statistics[/url]

    The SQL Guy @ blogspot[/url]

    @SeanPearceSQL

    About Me[/url]