performance optimization of multi-level grouping aggregation