I have a apex class which uses a many aggregate queries to form a list<Survey__c>.
- Apex CPU limit is exceeded when I try to insert this list. I have already divided the list into two parts, but the CPU time is still exceeded.
I basically need to divide this into smaller chunks of data to insert (less than 200 or 150 records). Can anyone help me achieve this?
Also, what will happen if the list size is a prime number? (Eg: 5179 records) Will I still be able to divide it by any number?
Is there any other way to handle this error?
Thank you!