The whole aim of having the batch class is to create an extract csv. in my execute method, I am processing over my records and grouping them and performing calculation and storing it in a map of String and csvformatWrapperClass. In the finish method , I am sorting the map values and then iterating over the map values and creating a csv file. This process runs fine for smaller number of records, however fails when I am trying to perform it with 70K+ records with the below error
First error: Apex CPU time limit exceeded
When I monitor the job, it process every batch of records and status changes to complete , and then after few seconds of it saying complete , I get the above message on status details, which makes me think that I am doing some thing wrong in finish method.