Exam PDI Topic 3 Question 52 Discussion

Actual exam question for Salesforce's PDI exam
Question #: 52
Topic #: 3
Universal Containers has a Visualforce page that displays a table of every Container___c being rented by a given Account. Recently this page is failing with a view state limit because some of the customers rent over 10,000 containers.
What should a developer change about the Visualforce page to help with the page load errors?

Suggested Answer: C Vote an answer

To address the view state limit error caused by loading over 10,000 records in a Visualforce page, the developer should implement pagination with a StandardSetController.
StandardSetController: This controller allows developers to easily paginate large sets of records in Visualforce pages.
"A StandardSetController object contains a reference to a list of records with pagination support, similar to the display in a list view."
- Apex Developer Guide: StandardSetController Class
Benefits:
Efficient Data Handling: It retrieves only a subset of records at a time, reducing the amount of data held in view state.
Built-in Pagination: Provides methods to navigate through pages of records (next, previous, etc.).
View State Limit: Visualforce pages have a view state limit of 170KB. Loading all records at once exceeds this limit.
"To optimize your Visualforce pages, minimize your use of view state. The view state of a Visualforce page is limited to 170KB."
- Visualforce Developer Guide: View State in Visualforce Pages
Why Not Other Options:
A . Implement pagination with an OffsetController: There's no standard OffsetController in Visualforce. Implementing custom pagination with offsets is less efficient and can be complex.
B . Use JavaScript remoting with SOQL Offset: While JavaScript remoting can reduce view state size, using SOQL OFFSET is not efficient for large offsets (over 2,000 records).
"When using OFFSET with a large number of records, performance degrades significantly."
- SOQL and SOSL Reference: OFFSET Clause
D . Use lazy loading and a transient List variable: Lazy loading can help, but it doesn't solve the issue of handling large datasets efficiently. Transient variables reduce view state but do not manage data retrieval or pagination.
Conclusion: Implementing pagination with a StandardSetController is the recommended solution to handle large datasets efficiently in Visualforce pages and prevent view state limit errors.

by Alexia at Jul 10, 2026, 11:00 PM

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
Nick name: Submit Cancel
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

0
0
0
10