Udostępnij za pośrednictwem


Stream Aggregate Showplan Operator

The Stream agregacja operator groups rows by one or more columns and then calculates one or more agregacja expressions returned by the query.Dane wyjściowe tego operator można odwoływać się do kwerendy, zwracane do klient i/lub podmiotów gospodarczych, później.The Stream agregacja operator requires input ordered by the columns within its groups.Optymalizator użyje Operator sortowania przed do tego operatora, gdy dane nie jest już posortowana ze względu na wcześniejsze Sortowanie operator lub ze względu na uporządkowanej indeks wyszukiwania lub skanowania.In the SHOWPLAN_ALL statement or the graphical execution plan in SQL Server Management Studio, the columns in the GROUP BY predicate are listed in the Argument column, and the aggregate expressions are listed in the DefinedValues column.

Strumień agregacja jest operator fizycznych.

Stream aggregate operator iconIkona planu wykonywania graficzny

Przykłady

W poniższym przykładzie następuje wybranie danych z SalesPerson Tabela i agreguje wartości dla Bonus i SalesYTD kolumny, według regionów. Dane wyjściowe plan wykonania wskazuje, że optymalizator kwerendy używa Strumień agregacja operator grupowanie wierszy w SalesPerson Tabela przez TerritoryID kolumna, a następnie obliczyć wartości AVG(Bonus) i SUM(SalesYTD) kolumna oparte na tej grupy.

USE AdventureWorks;
GO
SET NOCOUNT ON;
go
SET SHOWPLAN_ALL ON;
GO
SELECT TerritoryID, 
    AVG(Bonus) AS 'Average bonus', 
    SUM(SalesYTD) AS'YTD sales'
FROM Sales.SalesPerson
GROUP BY TerritoryID;
GO
SET SHOWPLAN_ALL OFF;

Wykonanie planu produkcji Agregat strumienia operator pojawi się poniżej.

StmtText 
------------------------------------------------------------------------------------------------
|--Stream Aggregate(GROUP BY:([AdventureWorks].[Sales].[SalesPerson].[TerritoryID]) )
        DEFINE:([Expr1011]=Count(*), 
                [Expr1012]= SUM([AdventureWorks].[Sales].[SalesPerson].[Bonus]), 
                [Expr1004]=SUM([AdventureWorks].[Sales].[SalesPerson].[SalesYTD])))

Argument
-----------------------------------------------------------------------------------------------
GROUP BY:([AdventureWorks].[Sales].[SalesPerson].[TerritoryID]

DefinedValues
----------------------------------------------------------------------------------------------
[Expr1011]=Count(*), 
[Expr1012]=SUM([AdventureWorks].[Sales].[SalesPerson].[Bonus]),
[Expr1004]=SUM([AdventureWorks].[Sales].[SalesPerson].[SalesYTD])