Database.Batchable in Salesforce, but if you want to use SOQL having aggregate functions like SUM(), MAX(), COUNT() on results grouped by “GROUP BY” clause in start execution, changing to interface Database.Batchablehttps://www.xgeek.net/zh/salesforce/using-aggregate-soql-queries-results-in-batch-apex/