Every Salesforce developer has written a Batch Apex job. The routine is familiar: write three lifecycle methods, schedule the job, and come back later to check the Apex Jobs log.
For years, this was the only real option for large-volume data processing. Furthermore, it worked well enough that most teams never questioned it.
But the Salesforce platform has moved on. Today, a combination of Apex Cursors, Queueable chaining, and event-driven design is reshaping how modern teams approach Salesforce async Apex patterns. So the question worth asking is this: do we still need Batch Apex the way we used to?
The Real Limitations of Batch Apex
Batch Apex is a workhorse. It processes millions of records reliably and each batch runs as a separate Apex transaction. However, that architecture comes with friction that compounds quickly in complex implementations.
First, the lifecycle is rigid. Every Batch Apex class forces you through start, execute, and finish. That structure adds boilerplate even for straightforward jobs. Additionally, the default batch size is 200 records, which is adjustable up to 2,000 but not finer than that.
Second, only five batch jobs can run simultaneously in a Salesforce org. Therefore, high-traffic orgs with multiple scheduled jobs risk delays and queuing conflicts. Third, Batch Apex cannot call future methods, which limits integration patterns significantly. You also cannot easily chain Batch Apex jobs in a dynamic, conditional way.
Finally, Batch Apex is fundamentally scheduled and static. It waits for its window. In a world moving toward real-time event-driven architecture, that wait has a cost.
Enter Database.getCursor(): A Smarter Way to Stream Data
Apex Cursors arrived as a beta feature and became generally available in Salesforce Spring ’26. They introduce a fundamentally different mental model for working with large datasets.
Instead of handing Salesforce a full query and waiting for chunked execution, you create a cursor and stream results on your own terms. You call Database.getCursor() with a SOQL query. Then you fetch exactly the records you need, when you need them.
How Apex Cursors Work
The core API is straightforward:
public class QueryChunkingQueuable implements Queueable {
private Database.Cursor locator;
private Integer position;
public QueryChunkingQueuable() {
locator = Database.getCursor('SELECT Id, Name FROM Lead WHERE CreatedDate = LAST_N_DAYS:30');
position = 0;
}
public void execute(QueueableContext ctx) {
List<Lead> scope = locator.fetch(position, 200);
position += scope.size();
// Your processing logic here
if (position < locator.getNumRecords()) {
System.enqueueJob(this);
}
}
}
Notice the absence of start, execute, and finish. One class. One self-contained job. Consequently, the code is dramatically easier to read, test, and maintain.
What Apex Cursors Bring to the Table
Apex Cursors support up to 50 million rows per cursor. Moreover, they allow forward and backward navigation through results, something SOQL OFFSET never could handle beyond 2,000 records.
Crucially, heap usage stays low. Traditional SOQL loads entire result sets into memory. By contrast, Cursors stream data in manageable chunks, keeping your memory footprint predictable.
The daily limits are generous too: up to 10,000 cursors per day and up to 100 million aggregate rows per day. For most enterprise orgs, that headroom is more than sufficient.
Queueable Apex: The Async Pattern That Scales
Queueable Apex has existed for some time, but it genuinely shines when combined with Apex Cursors. Together, they form a modern, event-responsive processing pattern.
Why Queueable Outperforms Batch in Many Scenarios
Unlike Batch Apex, Queueable jobs can chain up to 50 times in a standard org. Therefore, you can build dynamic processing pipelines that respond to intermediate results. Additionally, Queueable supports complex object types as parameters, unlike future methods.
Queueable jobs also support callouts to external systems, making them the right choice for integration patterns. Furthermore, they can be enqueued from triggers, future methods, other Queueable classes, and even Platform Event subscribers.
The most powerful pattern is cursor-driven Queueable chaining. Each execution fetches the next chunk, processes it, and re-enqueues itself until the dataset is complete. Importantly, you decide the chunk size dynamically. That level of control is simply not available in traditional Batch Apex.
When to Still Use Batch Apex
Despite the advantages of Cursors and Queueable, Batch Apex is not obsolete. It remains the right tool in specific situations.
Use Batch Apex when your processing logic is straightforward and predictable. It is also preferable when you need Salesforce’s built-in retry mechanism for failed batches. Moreover, Batch Apex has been GA for many years, making it the safer choice in highly regulated environments where beta or newer GA features require additional validation.
In short: Batch Apex is stable. However, stable does not mean optimal for every use case.
Event-Driven Design: The Bigger Architecture Shift
Beyond Cursors and Queueable, the real architectural conversation is about moving to event-driven processing entirely. Platform Events are central to this shift.
Platform Events as the Trigger Layer
Rather than scheduling a batch job to check for updated records at midnight, an event-driven architecture publishes a Platform Event the moment something meaningful happens. Downstream subscribers react immediately.
This approach unlocks real-time processing. A case escalation fires an event. A subscriber Queueable picks it up and processes the record within seconds. As a result, your data pipeline is reactive rather than periodic.
Platform Events also decouple your systems cleanly. Publishers do not need to know who is listening. Furthermore, subscribers can include Apex triggers, Flows, or external systems consuming via the CometD API.
Combining the Patterns
The most scalable Salesforce async Apex patterns in 2026 combine all three approaches:
- Platform Events handle real-time triggers and decoupled messaging
- Queueable Apex manages chained, stateful processing chains
- Database.getCursor() streams large datasets without memory overload
Consider a real-world scenario. An external system pushes a bulk data import. A Platform Event fires for each record batch. A Queueable subscriber picks up each event, uses a Cursor to fetch related records efficiently, and processes everything within governor limits.
There is no scheduled batch window to wait on. The entire start/execute/finish lifecycle simply disappears.
Quick Comparison: Batch Apex vs Apex Cursors + Queueable
| Feature | Batch Apex | Cursors + Queueable |
|---|---|---|
| Lifecycle complexity | High (3 methods) | Low (1 class) |
| Concurrent job limit | 5 | Up to 100 |
| Dynamic chunk sizing | No | Yes |
| Supports future methods | No | Yes (via Queueable) |
| Real-time triggering | No | Yes |
| Max records | 50 million | 50 million |
| Memory efficiency | Lower | Higher |
| GA status | GA (stable) | GA (Spring ’26) |
| Best for | Predictable bulk jobs | Flexible async pipelines |
Best Practices for Modern Salesforce Async Apex Patterns
Keep Chunks Small and Predictable
Fetch 100 to 200 records per transaction when using Apex Cursors. This keeps heap usage well within limits and avoids CPU timeout errors. Additionally, track your position variable carefully to prevent reprocessing or skipping records.
Handle Cursor Exceptions Properly
Apex Cursors throw two distinct exceptions. TransientCursorException signals a retryable failure such as a network issue. FatalCursorException signals a non-recoverable error such as an invalid query. Build your error handling to distinguish between the two.
Monitor Your Daily Limits
Use Limits.getApexCursorRows() to track aggregate daily usage. Stay aware of the 100 million row daily aggregate limit across your org. Large-scale migrations or integrations can consume this allowance faster than expected.
Use Platform Events to Decouple Triggers from Processing
Avoid calling Queueable jobs directly from triggers whenever possible. Instead, publish a Platform Event in the trigger and let a subscriber handle async processing. This approach is cleaner, easier to test, and far more resilient to recursive trigger issues.
Know When Not to Chain
Queueable chaining is powerful. However, unlimited chaining without circuit breakers can create runaway jobs. Always implement a maximum depth counter or a Custom Metadata flag to pause or stop chains when needed.
Is Batch Apex Dead?
No. It is not dead. However, it is no longer the automatic default for async processing on Salesforce.
The platform has evolved. Apex Cursors deliver fine-grained control over large data volumes. Queueable Apex enables dynamic, chainable, callout-capable processing. Platform Events enable reactive, decoupled architectures.
The right Salesforce async Apex pattern depends on your use case. For real-time, event-driven pipelines with flexible chunk sizes, Cursors and Queueable are clearly the modern path. For predictable, scheduled bulk operations with simple logic, Batch Apex remains a solid choice.
The most skilled Salesforce developers in 2026 do not pick one approach and apply it everywhere. Instead, they understand the tradeoffs and select the right pattern for each problem. That is what separates a good Apex developer from a great one.
Key Takeaways
- Database.getCursor() streams large datasets in flexible chunks without Batch Apex’s lifecycle overhead
- Queueable Apex supports up to 100 concurrent jobs versus Batch Apex’s limit of 5
- Apex Cursors are generally available in Spring ’26 and support up to 50 million rows per cursor
- Platform Events enable real-time, decoupled processing that eliminates the need for scheduled batch windows
- Modern Salesforce async Apex patterns combine Cursors, Queueable chains, and event-driven design
- Batch Apex remains valid for stable, predictable, scheduled bulk processing
- Always handle TransientCursorException and FatalCursorException separately in cursor-based jobs
Read More!
Your Salesforce Already Automates. Here’s Why That’s No Longer Enough
Hello, I’d like to understand more about the platform event pattern. I see it used in cases where you need to share information with multiple consumers, but what is the advantage of using it to launch a queueable job? Regarding recursive triggers, wouldn’t this approach create multiple events to be processed and therefore generate multiple queueable jobs as well?
Great questions Mateus!
Let me break both of them down.
On Platform Events launching a Queueable: the main benefit is not about reaching multiple consumers. It is about reliability. When you enqueue a Queueable directly from a trigger, that enqueue is part of the same transaction. So if anything in that transaction fails and rolls back, your job disappears with it.
Platform Events avoid that problem because a published event commits to the event bus independently. Even if the rest of your transaction fails, the event is already out there and your Queueable will still run. Think of it as a more resilient handoff between your trigger and your background processing.
On your recursion concern, you are spot on. If your trigger publishes an event on every record update, and your Queueable then updates those same records and fires the trigger again, you can end up with a chain of events growing very fast.
Solution to this is straightforward though. First, publish one event covering the whole batch of records rather than one event per record. Second, make sure your Queueable updates records in a way that does not re-trigger the same condition, either by marking records as already processed or by using a bypass check before publishing.
So the pattern works really well in practice, it just needs the same recursion awareness you would bring to any trigger design.
Hope that helps!