 Hi there, this is Krishnan from Bytescout and in this video, we will be going to learn about the next operator of the T-SQL execution plan called a stream aggregate. The stream aggregate operator group rows by one or more columns and then aggregate expressions calculated for this specified query. And the most common types of aggregate functions are sum, count, average, minimum, and max function. And when we execute these aggregation functions, stream aggregate operator appears in the execution plan. The stream aggregation is very fast because it requires an input that has already been shorted by the columns specified in the group by close. And if the aggregated data is not shorted, then optimizer can use a short operator to pre-short the records. We will see this practically in the demo in a very few minutes. Alright, a stream aggregate is divided into two types, the scalar aggregation and the group aggregation. The scalar aggregations are queries that use an aggregation function but do not have a group by close. And a group aggregations are the queries that have a column specified in the group by close. Alright, now let's perform the demo for each of these aggregation. Okay, so for this demo, let's start off by this simple query. Now, as I said earlier that stream aggregation is divided into two types, the scalar aggregation and the group aggregation. So let's start with the scalar aggregation with this query where I'm retrieving the total number of employee records from this employee table. Now, let's execute this query. And if we look at the execution plan, we can see that the first step is to read all the rows from the employee table using the index can. And then we have a stream aggregate operator which perform the count star operation. And after the count, we have the compute scalar operator. And we are seeing this compute scalar operator because after the count, the result of the count is placed into this expression and the compute scalar operator convert this expression to an integer data type. Alright, now let's move to the next query. Our next query is in conjunction with group by close. So what this query will do is it will return me the count of rows by employees job title. So let's go ahead and execute this query. And now if we look at the execution plan, so here again SQL server reads all the data from the employee table via this clustered index can. And then we have a short operator which shorts the records by the job title and SQL server then start the aggregation. Now in our case, you can see that the records are not shorted on the job title column. And that's why we have a short operator in our execution plan. Now to get rid of this short operator, let's create this non clustered index on job title column. So let's create this index. And now once again, when we execute this query, and when we check the execution plan and this time you can see that the short operator is gone and our query is returning the fast result in comparison with the previous query. And it is because now the SQL server is taking the advantage of this index which we have created above and it uses the order index by job title to perform the aggregation, which you can see over here. So now because the rows are already been shorted, SQL server doesn't need to short the data. And this is why in the execution plan, this index can is immediately followed by our stream aggregate operator. All right, now in the next video, we will learn about the next tsql plan operator called hash match aggregate.