Databases Reference
In-Depth Information
easily located. Every row in a non-clustered index created on a heap contains the RID of
the corresponding heap record.
To clean up, simply remove the index you just created:
DROP INDEX DatabaseLog . IX_Object
Listing 2-14.
Aggregations
Aggregations are used in databases to summarize information about some set of data.
The result can be a single value, such as the average salary for a company, or it can be a
per-group value, like the average salary by department. SQL Server has two operators to
implement aggregations, Stream Aggregate and Hash Aggregate , and they can be used to
solve queries with aggregation functions (like SUM , AVG or MAX ), the GROUP BY clause, or
the DISTINCT keyword.
Sorting and hashing
Before introducing the remaining operators of this chapter, I would like to add a brief
discussion on sorting and hashing, which play a very important role in some of the
operators and algorithms of the Execution Engine. For example, two of the operators
covered on this chapter, Stream Aggregate and Merge Join, require data to be already
sorted. To provide sorted data, the Query Optimizer may employ an existing index, or it
may explicitly introduce a Sort operator.
Search WWH ::




Custom Search