The trigger written in my salesforce org is hitting the apex cpu time limit . Hence I am trying to optimize apex code and reducing the workflow updates. But below log is confusing me about the apex governor limits:

16:11:02.820 |LIMIT_USAGE_FOR_NS|(default)|
  Number of SOQL queries: 2 out of 100
  Number of query rows: 203 out of 50000
  Number of SOSL queries: 0 out of 20
  Number of DML statements: 2 out of 150
  Number of DML rows: 201 out of 10000
  Maximum CPU time: 19336 out of 10000 ******* CLOSE TO LIMIT
  Maximum heap size: 0 out of 6000000
  Number of callouts: 0 out of 100
  Number of Email Invocations: 0 out of 10
  Number of future calls: 0 out of 50
  Number of queueable jobs added to the queue: 0 out of 50
  Number of Mobile Apex push calls: 0 out of 10
16:11:02.820 (91820619113)|CUMULATIVE_LIMIT_USAGE_END

Can anyone help me understand why does it show

Maximum CPU time: 19336 out of 10000 * CLOSE TO LIMIT

As salesforce governor limit for CPU time is 10000ms, it should throw error right after 10000ms. Am I missing something here? I am not able to see the actual consumption of CPU time in the logs,as the debug log size is big and salesforce is supressing the system.debugs I have put in the code. Can anyone suggest if there is any effective way to debug the apex CPU limit consumption?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.