Batchable インターフェースの実装時に Apex クラスの execute() メソッド内で apex コードが実行される場合、ガバナ制限に関して正しい文はどれですか? 2つの答えを選択してください
正解:A,B
When Apex code executes inside the execute() method of an Apex class that implements the Batchable interface, the following statements are true regarding governor limits:
* The Apex governor limits might be higher due to the asynchronous nature of the transaction. Asynchronous Apex, such as Batch Apex, runs in a separate thread from the main execution and can have higher limits for some resources, such as heap size and CPU time12. For example, the maximum heap size for synchronous Apex is 6 MB, while for asynchronous Apex it is 12 MB1.
* The Apex governor limits are reset for each iteration of the execute() method. Each execution of a batch Apex job is considered a discrete transaction, and the governor limits are reset for each transaction12. For example, a batch Apex job that contains 1,000 records and is executed without the optional scope parameter from Database.executeBatch is considered five transactions of 200 records each1.
The other statements are not true because:
* The Apex governor limits are relaxed while calling the constructor of the Apex class. This statement is false, because the constructor of the Apex class is executed in the same context as the caller of the Database.executeBatch method, and the same governor limits apply2. For example, if the constructor is called from a trigger, the trigger governor limits are enforced2.
* The Apex governor limits cannot be exceeded due to the asynchronous nature of the transaction. This
* statement is false, because the asynchronous nature of the transaction does not prevent the Apex governor limits from being exceeded. If some Apex code exceeds a limit, the associated governor issues a runtime exception that can't be handled1. For example, if the execute() method performs more than
200 SOQL queries, the Too many SOQL queries exception is thrown1.
References:
* : Apex Governor Limits
* : Using Batch Apex