May 2019
Intermediate to advanced
484 pages
11h 23m
English
The Hash Match (Aggregate) operator also performs aggregation to support GROUP BY, but while stream aggregation requires the input to be sorted, Hash aggregation does not. Hash aggregation is effectively the same as a Hash join, the difference is that there is only a single input to process. As with a Hash join, Hash aggregation consumes additional CPU and memory to store the hash table and may be subject to hash recursion and additional I/O in the form of spills to TempDB.
The following example shows a query executed in the AdventureWorks sample database with a Hash Match (Aggregate) operator:
SELECT p.Name AS ProductName, SUM(OrderQty) AS TotalProductSalesFROM Sales.SalesOrderDetail sodINNER JOIN Production.Product p on ...
Read now
Unlock full access