May 2019
Intermediate to advanced
484 pages
11h 23m
English
As mentioned previously, aggregation is used to group rows together when a query contains a GROUP BY clause. With a GROUP BY clause, the SELECT list typically has one or more aggregate functions, such as SUM, MIN, or MAX. If the input to the aggregation operation is already sorted by the GROUP BY columns, a Stream Aggregate operator can be used. Stream aggregation is the more efficient of the two aggregation operators in that it does not require much additional CPU or memory, the rows are processed as they pass through the operator.
The following example shows a query executed in the AdventureWorks sample database with a stream aggregate operator:
SELECT SalesOrderID, COUNT(*) AS ItemCountFROM Sales.SalesOrderDetailGROUP ...
Read now
Unlock full access