thinQmaster Virtual testing partner Adaptive practice exams that find your weak spots and drill them. Every answer explained. From $69
Enroll

thinQmaster

Find your exam

Five questions free, before you decide.

Step 1 · choose a vendor

In one of our camps? Your practice exams come with the tuition — they are on your study page already.

Business Platforms & EA · Intermediate

Batch Apex

Asynchronous Apex implementing Database.Batchable to process large record sets in chunks with start, execute and finish methods.

Definition

start returns a QueryLocator (up to 50 million records) or Iterable; execute runs per batch (default 200, up to 2,000) with fresh limits; finish runs once. Database.Stateful preserves instance state across batches. Up to 5 batch jobs can be active concurrently, with more held in the flex queue.

Example

Database.executeBatch(new CleanupBatch(), 500);

Exam tip

Batch Apex is the answer for processing millions of records; each execute gets its own governor limits.

Related terms