SF-PD2 Performance Practice Question
A developer is optimizing a Visualforce page that displays a large table of OpportunityLineItem records. The page uses a standard controller with an extension that queries all related OpportunityLineItems for an Opportunity. The page loads slowly for Opportunities with thousands of line items. The developer wants to improve performance without changing the user interface significantly. Which approach is most effective?
⚠ Common exam trap
The trap here is assuming that readOnly or asynchronous loading solves the performance issue, when the real problem is the volume of records rendered on the page.
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 using a StandardSetController to limit the number of records displayed per page.
Pagination with StandardSetController limits the records loaded and rendered per page, reducing view state and improving load time. It is the most effective approach for large data sets in Visualforce without changing the UI significantly. Other options either do not reduce data volume or are not feasible.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Use JavaScript Remoting to load all records asynchronously after the page renders.
Why it's wrong here
JavaScript Remoting can improve perceived performance by loading data asynchronously, but it still transfers all records to the client, which can be slow and may hit other limits. It does not reduce the amount of data processed, and the initial page load might still be heavy if the data is large.
- ✗
Set the readOnly attribute of the <apex:page> component to true.
Why it's wrong here
Setting readOnly to true can improve performance by reducing view state and allowing more query rows, but it does not reduce the number of records loaded. For thousands of line items, the page would still render all records, leading to slow load times. Pagination is more effective for large data sets.
- ✗
Increase the view state limit by contacting Salesforce support to raise the limit.
Why it's wrong here
View state limit is 170 KB for Visualforce pages and cannot be increased by support. Exceeding it causes an error. This is not a viable performance optimization; it would not solve the underlying issue of large data volume.
- ✓
Implement pagination using a StandardSetController to limit the number of records displayed per page.
Why this is correct
StandardSetController supports pagination and reduces the number of records loaded and rendered at once. This decreases view state size and improves page load time. It is a standard approach for handling large data sets in Visualforce without major UI changes.
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 →
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.