Hash Warning Event Class

Hash Warning Event Class


Applies To: SQL Server 2016


Hash recursion occurs when the build input does not fit into available memory, resulting in the split of input into multiple partitions that are processed separately. If any of these partitions still do not fit into available memory, it is split into subpartitions, which are also processed separately. This splitting process continues until each partition fits into available memory or until the maximum recursion level is reached (displayed in the IntegerData data column).


Hash recursion and hash bailout cause reduced performance in your server. To eliminate or reduce the frequency of hash recursion and bailouts, do one of the following:

  • Make sure that statistics exist on the columns that are being joined or grouped.

  • If statistics exist on the columns, update them.

  • Use a different type of join. For example, use a MERGE or LOOP join instead, if appropriate.

  • Increase available memory on the computer. Hash recursion or bailout occurs when there is not enough memory to process queries in place and they need to spill to disk.

Creating or updating the statistics on the column involved in the join is the most effective way to reduce the number of hash recursion or bailouts that occur.

System_CAPS_ICON_note.jpg Note

The terms grace hash join and recursive hash join are also used to describe hash bailout.

System_CAPS_ICON_important.jpg Important

To determine where the Hash Warning event is occurring when the query optimizer generates an execution plan, you should also collect a Showplan event class in the trace. You can choose any of the Showplan event classes except the Showplan Text and Showplan Text (Unencoded) event classes, which do not return a Node ID. Node IDs in Showplans identify each operation the query optimizer performs when it generates a query execution plan. These operations are called operators, and each operator in a Showplan has a Node ID. The ObjectID column for Hash Warning events corresponds to the Node ID in Showplans so you can determine which operator, or operation, is causing the error.

Data column nameData typeDescriptionColumn IDFilterable
ApplicationNamenvarcharName of the client application that created the connection to an instance of SQL Server. This column is populated with the values passed by the application rather than with the displayed name of the program.10Yes
ClientProcessIDintID assigned by the host computer to the process where the client application is running. This data column is populated if the client provides a client process ID.9Yes
EventClassintType of event = 55.27No
EventSequenceintSequence of a given event within the request.51No
EventSubClassintType of event subclass.


IntegerDataintRecursion level (hash recursion only).25Yes
NTDomainNamenvarcharWindows domain to which the user belongs.7Yes
NTUserNamenvarcharWindows user name.6Yes
ObjectIDintNode ID of the root of the hash team involved in the repartition. Corresponds with the Node ID in Showplans.22Yes
RequestIDintID of the request that contains the statement.49Yes
ServerNamenvarcharName of the instance of SQL Server that is being traced.26
SPIDintID of the session on which the event occurred.12Yes
StartTimedatetimeTime at which the event started, if available.14Yes
TransactionIDbigintSystem-assigned ID of the transaction.4Yes
XactSequencebigintToken that describes the current transaction.50Yes

sp_trace_setevent (Transact-SQL)

Community Additions

© 2016 Microsoft