The clsPartitionAnalyzer AddExistingAggregation method adds a specified aggregation to the DesignedAggregations collection and returns the calculated percentage performance gain (dblPercentageBenefit), aggregation storage requirements (dblAccumulatedSize), and total number of aggregations created (lngAggregationsCount) based upon the inclusion of this aggregation.
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 will include this aggregation.
dsoPartAnalyzer. AddExistingAggregation(Aggregation, dblPercentageBenefit, dblAccumulatedSize, lngAggregationsCount)
Use the following code to add an aggregation, from an existing partition's MDStores (objects of ClassType clsAggregation) collection, named Agg123 to the DesignedAggregations collection and then run several analysis steps. The analysis continues until one of the following two goals is reached.
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 thru 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
clsAggregation | clsPartitionAnalyzer |
clsPartition | Using Decision Support Objects |