Skip to main content

SF-0372 · Concept · Medium

What is the maximum and minimum size of the optional parameter "scope"?

✓ Verified by Vikas Singhal · Last reviewed 5/17/2026 · Updated for Spring '26

The scope parameter of Database.executeBatch accepts an integer between 1 and 2,000.

BoundValue
Minimum1
Maximum2,000
Default (no value passed)200

Below 1 or above 2,000, Salesforce throws System.InvalidValueException (or simply ignores the value, falling back to 200, depending on the call form).

How to set it

// Default: 200 per chunk
Database.executeBatch(new MyBatch());

// Custom: 50 per chunk
Database.executeBatch(new MyBatch(), 50);

// Max
Database.executeBatch(new MyBatch(), 2000);

What scope size actually controls

Each execute invocation receives a List<sObject> scope containing that many records. Each invocation is its own transaction with its own governor limits.

Chunk sizeEffect
1One transaction per record. Highest overhead, safest for very heavy per-record logic.
50Good for callout-heavy batches (callouts are limited per transaction).
200 (default)Standard balance — good for most jobs.
1000Fewer transactions, bigger chunks. Risk of CPU/SOQL limit blowouts.
2000Maximum efficiency, maximum risk.

How to choose

SituationSuggested chunk size
Simple field updates, no triggers cascading200
Triggers/flows that update related records50–100
Each record triggers a callout10–25 (callouts limited to 100 per transaction)
Heavy CPU work per record (calc, parse)25–100
Pure DML on cold records (no side effects)500–2000
Hitting governor limits at 200Drop to 50 or 25
Want to minimize total transactions2000

Why bigger isn’t always better

Each chunk runs in one transaction:

Per-transaction limitValue
SOQL queries100
DML statements150
DML rows10,000
CPU time60,000 ms
Heap12 MB

If your execute makes 1 SOQL per record and you set chunk size to 2,000, you hit the 100-SOQL limit on the 101st record. Always bulkify so the chunk runs in constant number of SOQL/DML regardless of size.

How chunking interacts with QueryLocator

Database.QueryLocator.start returns up to 50 million records. The platform pages through them in chunks of your scope size. So a 10 M record job with scope 200 spawns 50,000 chunks — each a separate transaction, separate governor limits.

Common interview follow-ups

  • Default scope size? — 200.
  • Maximum? — 2,000.
  • Why is there a maximum at all? — Each chunk must fit within governor limits — 2,000 is the platform-determined ceiling for safe operation.
  • Can I change scope mid-job? — No. It’s fixed at executeBatch time.

Verified against: Apex Developer Guide — Using Batch Apex. Last reviewed 2026-05-17.