{hashtempkey}

The hashtempkey function causes the method chosen for joining data to use hashing. This is the fastest method for joining large sets of data.

The following example, which assumes there is no index on the column col_name, uses binary search of an ordered table to reduce work in performing the join.

 

Example:

SELECT a.*, b.*
FROM db.dbo.tab a, db.dbo.tab b
WHERE
a.col_name = b.col_name
{hashtempkey}