A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
Hi @M. Graham
SQL Server hash match aggregate is selected by query optimizer for the tables with large data and when they are not sorted.
Are you sure all joins on non-clustered indexes?
Hash operation builds a hash table in memory and Hash Key used for this table is displayed in properties window, could you check that?
Refer to this blog: SQL Server hash match aggregate operator
By the way, the alternative aggregation operator, Stream Aggregate, is faster and has less overhead; but it requires the input stream to be sorted. When no efficient way to sort the input is available, the optimizer will usually favor the Hash Match operator for aggregation. Similar to Stream Aggregate, Hash Match (Aggregate) can be used without a Defined Values property, to effectively perform a DISTINCT operation. Unlike Stream Aggregate, Hash Match (Aggregate) can not be used to compute a scalar aggregate (except in Batch Mode plans on SQL Server 2014 and up).
Best regards,
LiHong
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our Documentation to enable e-mail notifications if you want to receive the related email notification for this thread.