Press "Enter" to skip to content

Investigating Hash Match Spills to tempdb

Hugo Kornelis digs in when you’re overdrawn at the memory bank:

Finding data in tempdb is hard. Not when the data is in objects we created ourselves, such as temporary tables or variables. They are stored in the internal system tables and reflected in various system dynamic management views. But that changes for internal objects. They are only used by the internal logic of, in this case, the Hash Match operator. There is no advantage to storing them in the system tables. When I explored the internals of tables used by Table SpoolIndex Spool, and Window Spool, I found out that Microsoft has indeed not bothered to put anything in the system tables for such internal objects. The Hash Match operator is not different in this regard.

But I still found a way to locate this information.

Hugo explains how, though it does include some contrivances to make life a lot easier. I always love this sort of spelunking deep into the bowels of how things work, and Hugo is definitely on the top shelf when it comes to this kind of work.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.