Skip to main content

SF-0387 · Concept · Medium

What is the maximum limit of the apex flex queue?

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

The Apex Flex Queue holds up to 100 batch jobs in Holding status. Combined with the 5 jobs that can be Processing (active) at once, a single Salesforce org can have up to 105 batch jobs queued simultaneously waiting their turn.

The numbers

StateLimitDescription
Holding (in Flex Queue)100Waiting for an active slot
Processing (active)5Currently running
Total simultaneous batch jobs105Holding + Processing

Try to submit a 106th batch via Database.executeBatch and you get:

System.LimitException: Attempt to add a job to the apex flex queue failed because the queue is full.

How jobs flow through

  1. Database.executeBatch(new MyBatch()) is called.
  2. If fewer than 5 batches are Processing, your job goes straight to Processing.
  3. Otherwise, it goes to the Flex Queue with status Holding.
  4. When a Processing job completes, the front of the Flex Queue is promoted to Processing.
  5. The queue is FIFO by default — first in, first out — but you can reorder it via Setup or FlexQueue Apex APIs.

Where you see it

Setup → Apex Flex Queue lists all Holding jobs in order. You can:

  • View each job’s class and submitted date
  • Reorder positions (move up/down/top/bottom)
  • Abort individual Holding jobs

The Apex Flex Queue page is sibling to (but distinct from) Setup → Apex Jobs, which shows everything regardless of status.

Programmatic queue management

// Get a specific job's position
Boolean moved = FlexQueue.moveJobToFront(jobId);
Boolean back  = FlexQueue.moveJobToEnd(jobId);
Boolean above = FlexQueue.moveBeforeJob(jobId, otherJobId);
Boolean below = FlexQueue.moveAfterJob(jobId, otherJobId);

Each returns true on success. Reordering only affects Holding jobs — once Processing, the order is fixed.

What the limit applies to

Job typeCounts against Flex Queue?
Batch Apex (Database.executeBatch)Yes
Queueable (System.enqueueJob)No (different queue)
Scheduled Apex (System.schedule)No (different limit)
Future methodsNo (different limit)

Only batch uses the Flex Queue.

Common interview follow-ups

  • What if I submit job #106?LimitException: Apex Flex Queue is full.
  • Can the limit be raised? — No, it’s a fixed platform limit.
  • Why is the limit not visible in Limits class? — The Flex Queue limit is org-wide, not per-transaction; Limits.getQueueableJobs is for the per-transaction Queueable cap (50).

Verified against: Apex Developer Guide — Apex Flex Queue. Last reviewed 2026-05-17.