Aggregation performance

Hey Guys,

I would like to know how you guys maintaining the performance of the aggregation operation like min, max, sum, avg when it comes to millions of records? Are you guys maintaining any meta information or each time you do a calculation when the aggregation operation perform?