Courseiva
Performance →hardMultiple Choice

SF-PD2 Performance Practice Question

A developer is working on a Lightning Web Component that displays a list of 10,000 custom object records. The component currently uses an Apex controller method that returns all records in a single call, causing slow load times and occasional heap size limit exceptions. Which approach should the developer take to improve performance?

⚠ Common exam trap

The trap here is thinking that client-side caching or increasing heap size can solve the problem, but heap limits are fixed and caching does not reduce the initial payload size.

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

✓

Implement pagination in the Apex controller to return a limited number of records per call, and use the Lightning Web Component to request subsequent pages as needed.

Pagination is the best approach because it breaks the large dataset into smaller, manageable chunks. This reduces the amount of data processed and transferred at once, avoiding heap size limit exceptions and improving page load times. The LWC can request additional pages as the user scrolls or navigates, providing a responsive experience.

Answer analysis

Option-by-option breakdown

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

  • ✓

    Implement pagination in the Apex controller to return a limited number of records per call, and use the Lightning Web Component to request subsequent pages as needed.

    Why this is correct

    Pagination reduces the amount of data transferred in a single call, lowering heap usage and improving load times. The LWC can request pages on demand, providing a better user experience. This approach avoids hitting heap size limits and is a standard pattern for handling large datasets in Lightning.

  • ✗

    Increase the heap size limit by using the @AuraEnabled annotation with the 'continuation' attribute to handle long-running requests.

    Why it's wrong here

    The 'continuation' attribute is used for asynchronous callouts, not for increasing heap size. Heap size limits are fixed and cannot be increased. Continuations are for HTTP callouts to external services, not for querying large datasets within Salesforce.

  • ✗

    Use the @AuraEnabled(cacheable=true) annotation on the Apex method to cache the results on the client side.

    Why it's wrong here

    While caching can improve performance for repeated calls, it does not solve the initial problem of returning 10,000 records in one call, which may still exceed heap limits and cause slow load times. Caching is beneficial for infrequently changing data but does not address the large payload size.

  • ✗

    Move the data retrieval logic to a Visualforce page and embed it in the Lightning Web Component using an iframe.

    Why it's wrong here

    Embedding a Visualforce page in an iframe is not a recommended practice for Lightning Web Components and does not inherently improve performance. It adds complexity and may still face the same heap and query limits. This approach is outdated and not a performance optimization.

About these practice questions

This SF-PD2 question is part of Courseiva's 226-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. 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.