Things to Remember while working with Batch Apex:

  1. Use Batch Apex only if you have more than one batch of records else use Queueable Apex.
  2. You can query up to 50 million records with the QueryLocator object which bypasses the governor limit for the total number of records retrieved by SOQL queries.
  3. Every transaction starts with a new set of governor limits.
  4. If one batch fails to process successfully, all other successful batch transactions aren’t rolled back.
  5. The default batch size is 200 records.
  6. Batches of records are not guaranteed to execute in the order they are received from the start method.
  7. If invoking a batch job from Trigger, need to take care that trigger won’t add more batch jobs than the limit.
  8. Test methods can execute only one batch total, so the number of records inserted in test class should be less than the batch size of 200.
Like it ? Share : Do Nothing

Leave a Reply