Courseiva
Performance →hardMultiple Select

SF-PD2 Performance Practice Question

A developer is optimizing an Apex batch job that processes millions of records and must stay within governor limits while finishing in a reasonable time. Which TWO techniques improve performance and scalability for this batch job? (Choose two.)

⚠ Common exam trap

The trap here is thinking that a bigger batch size always means better performance, when per-transaction governor limits make smaller chunks safer for large jobs.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

Reduce the batch size so each execute method handles fewer records, lowering heap and CPU usage per transaction.

QueryLocator in the start method lets the batch stream very large result sets beyond the standard SOQL row limit, and a smaller batch size keeps each execute transaction under heap and CPU limits. Together they make a millions-of-records job complete reliably within governor constraints.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    Increase the batch size to the maximum so fewer total transactions are needed.

    Why it's wrong here

    Larger batch sizes increase the records processed per execute transaction, which raises heap and CPU usage and makes governor-limit failures more likely. While fewer transactions can reduce overhead, the per-transaction limits are the binding constraint for millions of records, so maximizing batch size is the wrong direction for a limits-bound job.

  • ✗

    Call Database.executeBatch from within the execute method to parallelize the work.

    Why it's wrong here

    Starting a batch job from inside another batch job's execute method is not allowed and throws a runtime error because batch jobs cannot be chained from within a running batch context. Parallelism must be configured through the batch size and the optional scope, not by nesting executeBatch calls. This option would fail outright.

  • ✗

    Perform all DML inside the start method so the execute method only reads data.

    Why it's wrong here

    The start method runs once and should only return the query locator; performing DML there is not supported for batch processing and would run outside the per-chunk transaction model. DML belongs in the execute method, where it is chunked and governed per batch. This option inverts the intended batch lifecycle and would break the job.

  • ✓

    Reduce the batch size so each execute method handles fewer records, lowering heap and CPU usage per transaction.

    Why this is correct

    Smaller batch sizes reduce the number of records processed per execute transaction, which lowers heap consumption and CPU time per chunk and makes it less likely that an individual transaction exceeds limits. It also lets the job recover more gracefully because only one batch fails if an error occurs, rather than the entire chunk. The trade-off is more transactions, but for heap-bound jobs this is often the right lever.

  • ✓

    Use Database.QueryLocator in the start method so the query can iterate over large result sets without hitting the 50,000-row SOQL limit.

    Why this is correct

    Database.QueryLocator lets Batch Apex process up to 50 million records because the platform streams the query results rather than materializing them under the standard 50,000-row SOQL limit. It is the recommended start-method return type for large-volume batch jobs and keeps memory usage bounded while the framework chunks records for each execute call.

About these practice questions

One of 226 original SF-PD2 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed September 2026 · checked against the official Salesforce exam blueprint

This SF-PD2 practice question is part of Courseiva's free Salesforce certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the SF-PD2 exam.