OBLYTECH Logo
OBLYTECH Logo

Cost-Aware Scheduling of Large Salesforce Batch Loads

Schedule a large Salesforce batch load by measuring what it will draw on before you pick a window: governor limit headroom, query selectivity, record lock contention, and the license and consumption capacity the org already pays for. Then run the load at a time that leaves peak business use and live integrations untouched.

Why a large load needs its own schedule

A batch load that runs at the wrong hour can slow every user and integration in the org. Salesforce runs on shared infrastructure, so the platform enforces governor limits that keep one customer from starving the rest. Those same limits apply inside your org to each transaction your load starts. A load that behaves well against a small test file can still time out when it runs against the full object during the morning sales peak.

Scheduling is where cost shows up. Batch work that competes with live users draws on the same shared capacity that users and integrations rely on. The usual results are slower screens, failed integration calls, retries and support requests. In practice the damage often means a second run to repair the first. Choosing the window in advance is cheaper than that work.

Review platform capacity before you choose a window

Start with a short capacity review. Write down the objects the load touches and the expected row counts, then list every trigger, flow and validation rule that fires on those objects. Each one takes a share of the transaction limits, so a step you skip in the review tends to surface as an error on the day of the load.

Next, list the work that already runs in the same hours:

  1. Each integration that reads from or writes to the same objects during the planned window.
  2. Scheduled Apex, scheduled flows and reports that run in that period.
  3. The users and integration accounts the load depends on, along with the license type and permission sets each one holds.
  4. The recent consumption trend for the org, read over several weeks rather than a single day.
  5. A named owner for each business hour that must stay clear.

Validation rules deserve their own check because they can reject rows that passed in a test. Review them alongside the integrations that feed the load, as covered in how to change validation rules without breaking integrations. For help planning this work, see Salesforce implementation.

Choose the asynchronous mechanism that fits the work

A synchronous transaction runs under tighter governor limits than an asynchronous one, and the user’s screen waits while it runs. Asynchronous contexts allow more room in several of those limits, and they keep the screen from waiting on the job. The limits themselves are explained in the governor limits guide for admins.

Asynchronous work carries its own costs. The result is not visible in the transaction that started it, so the business process has to tolerate a delay. A failure appears in a job log rather than in front of the person who triggered the load, so the load needs error handling and a person who checks the logs. Keep work synchronous when it fits comfortably inside the limits.

Match the mechanism to the shape of the work rather than to how close a limit feels:

  • Batch Apex suits volume. It splits the records into chunks and processes each chunk as its own unit of work, which is why it fits migrations, archival and bulk enrichment.
  • Queueable jobs suit ordered, multi-step work that goes beyond synchronous limits but does not need batch scale. A queueable job can chain a follow-on job.
  • Platform Events suit decoupled work, and each subscriber should be written to handle a repeated event without duplicating its writes.
  • Future methods suit simple asynchronous work with simple inputs, typically a callout from a trigger, and they are best kept for that narrow job.

If the load arrives as a file from another system, the import method matters as much as the timing. The options are compared in choosing a data loader for a Salesforce migration.

Protect query selectivity and record locks

Query selectivity decides whether a load scales. A selective query filters on indexed fields and locates records quickly. A non-selective query scans the whole object, uses database resources that other work needs, and can time out as the object grows. Before the load runs against a large object, check each query it executes against its plan, and treat a full scan on a high-volume object as a blocker rather than a warning.

Record locks are the second hazard. A single parent record with a very large number of child records tends to slow queries and create row-lock contention when work runs at the same time. Measure where that starts in your own org rather than relying on a fixed figure, and plan any load that writes heavily to one parent around it. Ownership works the same way: when one integration user owns a very large share of records, concurrent batches compete for the same rows.

  • Sort the input by parent Id so concurrent batches do not fight over the same parent rows.
  • Spread heavy writes across several parents where the data model allows it.
  • Set a scheduled check that flags any parent approaching the threshold.
  • Divide large volumes between more than one integration user when your security model allows it.

One hazard belongs in the schedule as well. A single transaction that changes setup objects, such as User or PermissionSet, alongside other objects, such as Account or a custom object, raises a mixed DML error. User provisioning loads are the usual case. Move the setup changes into their own transaction through asynchronous processing or Platform Events, and give them a separate step in the run plan.

Set batch size and the run window

Batch size sets how much each chunk asks of the platform at once. Design the automation so that a trigger handling a typical batch of records stays well inside its limits, so the same code holds up under heavier load. Then choose the window in three steps.

  1. Pick the lowest-use window the review identified, and leave a buffer before the first business hour that matters.
  2. Run a small pilot batch in that window and record its duration, error count and consumption.
  3. Start the full run only after the pilot matches expectations, with a stop condition that halts the job when the error count or duration passes a level agreed in advance.

Time zones can take away the quiet hour. If users work across several regions, the night in one region is the working day in another. In that case, choose the window by the busiest region and confirm which scheduled integrations run from other systems during it.

Test at realistic volume before the production run

Test against data that matches production in size and shape. A test environment built from configuration alone cannot show how the load behaves at full volume, because it holds no production-sized data. A copy that includes the data surfaces scalability problems before users do. A solution that works against a handful of records in a test environment can still hit governor limits in production. Run the query plans and the batch timing on the full copy, then compare the results with the expected production figures. Planning the refresh schedule for that copy is covered in sandbox refresh planning.

Watch consumption while the load runs

Monitoring turns the schedule into a control. Build dashboards that technical and business owners can both read, and configure alerts that fire when consumption reaches a threshold chosen before the run. That way a runaway job gets noticed while it is still running rather than after the window closes. Use the monitoring tools your org already has to watch long-running operations, row-lock contention and transactions that approach their limits, and note which trigger and object each one involves. Compare consumption over several weeks to judge whether the next window is still quiet.

Review the run once it finishes. Compare the actual duration, error count and consumption with the pilot figures, and record which step accounts for any difference. Keep the window, batch size and owner in the run record, so the next load starts from measured numbers rather than from memory. Consumption that drifts up between runs often shows here first.

Questions about timing and capacity for large loads

When should the load window be confirmed?

Confirm it after the pilot batch has run, because the pilot figures set the length of the window. Leave room in the calendar for one rerun. A stopped job often needs a second pass, and a window sized to the first attempt leaves no margin for it.

Who should watch the job while it runs?

Assign one person from the Salesforce team to read the job logs and the monitoring alerts, and one person from the business owner group to decide whether the run should stop. The first person can see the failure, and the second knows which users would feel it. Neither role should wait for someone else to notice a problem in a log.

What should happen when a job stops partway through?

Find out which records committed before anything reruns. Batches process chunks separately, so a partial run is a normal outcome, and a blind rerun can write the same rows twice. Where the data allows, mark completed rows with a status field or match them on an external ID field, then rerun only the remaining set.

Does the cost of a large load depend on license count?

Check your contract for how licenses and metered services are charged, since terms differ between orgs. A single load usually changes how much of the capacity you already pay for it is used, and whether any metered service is drawn down during the run. Review the license types of the users and integration accounts the load depends on, and compare the consumption trend before and after the run.