AddExistingAggregation (clsPartitionAnalyzer)
The AddExistingAggregation method of an object of ClassType clsPartitionAnalyzer adds an aggregation to the DesignedAggregations collection. It examines the aggregation and returns the calculated percentage performance gain, the total size of the aggregation, and the total number of aggregations in the partition that result from the inclusion of the aggregation.
Syntax
object. AddExistingAggregation(ByVal agg As MDStore, PercentageBenefit As Double, AccumulatedSize As Double, AggregationsCount As Long)
object
The object of ClassType clsPartitionAnalyzer used to perform the analysis.
agg
An MDStore object, representing the aggregation to add.
PercentageBenefit
The estimated percentage performance improvement that would be realized using the current collection of DesignedAggregations, as opposed to querying against the underlying fact table. This argument is used as an output parameter.
AccumulatedSize
The estimated hard disk storage requirements (in bytes) for the current collection of DesignedAggregations. This argument is used as an output parameter.
AggregationsCount
The number of aggregations contained in the current collection of DesignedAggregations. This argument is used as an output parameter.
Remarks
This method allows you to evaluate the impact of a particular aggregation on query performance. Subsequent analysis steps performed either by adding another existing aggregation or by using the NextAnalysisStep method include the added aggregation.
Example
Use the following code to add an aggregation, named Agg123, from the MDStores collection, which contains objects of ClassType clsAggregation of an existing partition to the DesignedAggregations collection, and then run several analysis steps. The analysis continues until one of the following two goals is reached:
- Twenty or more aggregations are designed.
- The storage requirements for the designed aggregations exceed 100,000 bytes.
For more information, see InitializeDesign.
'Assume an object (dsoCube) of ClassType clsCube exists
'with two partitions referenced by partition objects
'dsoPart1 and dsoPart2.
Dim bStopAdding As Boolean
Dim dblPercentageBenefit As Double
Dim dblAccumulatedSize As Double
Dim lngAggregationsCount As Long
'Get existing aggregation "Agg123" from first partition.
Dim dsoExistAgg As DSO.MDStore
Set dsoExistAgg = dsoPart1.MDStores("Agg123")
'Add aggregation to second partition.
Dim dsoPartAnalyzer As DSO.PartitionAnalyzer
Set dsoPartAnalyzer = dsoPart2.Analyzer
dsoPartAnalyzer.AddExistingAggregation dsoExistAgg, _
dblPercentageBenefit, dblAccumulatedSize, lngAggregationsCount
dsoPartAnalyzer.InitializeDesign
'Iterate through analysis until either goal is reached.
Do Until bStopAdding
If Not dsoPartAnalyzer.NextAnalysisStep(dblPercentageBenefit, _
dblAccumulatedSize, lngAggregationsCount) Then
bStopAdding = True 'No New Aggregations Designed
Else
bStopAdding = (lngAggregationsCount >= 20) Or _
(dblAccumulatedSize >= 100000)
End If
Loop