Each time the clsPartitionAnalyzer NextAnalysisStep method is invoked, it adds another set of aggregations to the DesignedAggregations collection. It calculates the query performance gained and the storage requirements for the additional aggregations.
bRet = dsoPartAnalyzer. NextAnalysisStep(dblPercentageBenefit, dblAccumulatedSize, lngAggregationsCount)
NextAnalysisStep analyzes a partition's schema and generates a collection of aggregations that improve query performance. You can run the analysis without constraints. If no constraints are specified, the analysis will yield a generalized optimization. For more information, see AddGoalQuery and PrepareGoalQueries.
Use the following code to run a series of analyses until either of the following two goals is reached:
For more information, see CloseAggregationAnalysis and InitializeDesign.
Place the following code in your form’s Declarations section:
'Assume the existence of an object (dsoPartAnalyzer) of ClassType
'clsPartitionAnalyzer
Private blnStopAdding          As Boolean
Private dblPercentageBenefit   As Double
Private dblAccumulatedSize     As Double
Private lngAggregationsCount   As Long
'Iterate thru analysis until either goal is reached
Do Until blnStopAdding  
    If Not dsoPartAnalyzer.NextAnalysisStep(dblPercentageBenefit, _
    dblAccumulatedSize, lngAggregationsCount) Then
        blnStopAdding = True 'No New Aggregations Designed
    Else
        blnStopAdding = (lngAggregationsCount >= 20) Or _
        (dblAccumulatedSize >= 100000)
    End If
Loop