PDI · Question #25
If apex code executes inside the execute() method of an Apex class when implementing the Batchable interface, which statement are true regarding governor limits? Choose 2 answers
The correct answer is B. The apex governor limits are reset for each iteration of the execute() method. C. The Apex governor limits are relaxed while calling the constructor of the Apex class. When Apex code executes in the execute() method of a Batchable class, governor limits are reset for each iteration, and relaxed limits apply during the start() method and constructor invocation.
Question
If apex code executes inside the execute() method of an Apex class when implementing the Batchable interface, which statement are true regarding governor limits? Choose 2 answers
Options
- AThe Apex governor limits might be higher due to the asynchronous nature of the transaction.
- BThe apex governor limits are reset for each iteration of the execute() method.
- CThe Apex governor limits are relaxed while calling the constructor of the Apex class.
- DThe Apex governor limits cannot be exceeded due to the asynchronous nature of the transaction.
How the community answered
(24 responses)- A13% (3)
- B83% (20)
- D4% (1)
Why each option
When Apex code executes in the `execute()` method of a Batchable class, governor limits are reset for each iteration, and relaxed limits apply during the `start()` method and constructor invocation.
While Batch Apex is asynchronous, it doesn't mean governor limits are universally 'higher'; rather, they are reset per `execute()` iteration and relaxed in `start()`, but still enforced.
The Apex governor limits are reset for each iteration of the `execute()` method in Batch Apex, treating each batch of records as a new transaction with its own set of limits.
During the `start()` method, which includes the constructor execution, Batch Apex operates under relaxed governor limits, providing more resources for initial data retrieval or complex setup logic.
Governor limits can still be exceeded in Batch Apex if an individual `execute()` method or the `start()` method itself performs too many operations; the asynchronous nature helps break down large tasks, but does not remove limits entirely.
Concept tested: Batch Apex Governor Limits
Source: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_batch_governor_limits.htm
Topics
Community Discussion
No community discussion yet for this question.