Chapter 8. Optimization and performance tuning 229
? Fetch values from the selected aggregate for rollups if not a direct hit.
If the query is not a direct hit, then roll ups are needed and processing continues. The
query is inspected to see what values are needed from the aggregate. A portion of the
query is issued against the aggregate to fetch the needed values.
For example, if the query is for [Retailers].[Americas] and the aggregate on
[Retailers].[Retailer Country], then the aggregate query will request values for every
country in the Americas. The fetch time is also recorded because many values might be
needed. This the log entry is shown in Example 8-2.
Example 8-2 Log entry
<event ...><![CDATA[Fetched 24,088 tuples in 549ms.]]></event>
? Process the aggregate values in multiple threads.
After the values are fetched from the aggregate, they are inspected to determine how
many values there are and how much work processing might be. This step determines
whether the processing is split into multiple subtasks that will execute in parallel. The
number of available threads is also accounted for, so a busy system will result in splitting
the processing into fewer subtasks.
Also, a calculation modifier value accounts for how many locations each aggregate cell
belongs to. Consider an example query that requests [Retailers].[Americas],
[Retailers].[Americas].[United States] and [Retailers].[Americas].[United
States].[Outdoor Gear Co-op]. The value for [Outdoor Gear Co-op] can be in, or
contribute to, three locations: itself, as part of [United States], and also as part of
[Americas]. More locations mean more work and a larger calculation modifier.
Example 8-3 shows the log entry.
Example 8-3 Log entry
<event ...><![CDATA[Using 4 tasks to process aggregate. Total number of
aggregate cells accessed: 24088 with a calculation modifier of 4.0]]></event>
? Combine values as each processing thread completes.
Each subtask works on its set of values independently. Then, as these subtasks finish
processing, their results are combined to form the final result set.
For example, if the query is for [Retailers].[Americas] and the aggregate on
[Retailers].[Retailer name], there can be a subtask for each country, rolling up the
values for all retailers from each country independently. Then, the original task only has to
roll up the country values together. An entry for each subtask is shown in the log entry in
Example 8-4.
Example 8-4 Log entry
<event ...><![CDATA[Aggregate calc thread finished. Processed 6,022 cells.
Rollup time : 162 ms into 72 cells with 0 cells in the overfetchResultSet.
Result combination time 2ms, representing 1 calc threads. Cell cache hit
rate: 99% 99% 99% 99% 99% 99% 99% 99%]]></event>
? Query processing is complete.
After all the subtask results are combined, the final result set is returned. The log record in
Example 8-5 on page 230 signifies the end of this processing and captures some metrics.