Plat-Dev-301 practice question 4 of 10
There is an Apex controller and a Visualforce page in an org that displays records with a custom filter consisting of a combination of picklist…
Full set: 160 questionsThe scenario describes two related problems: slow performance and exceeding the view state size limit (135 KB). Both issues stem from querying and attempting to manage too large a record set in the controller's memory. A StandardSetController is the idiomatic Visualforce solution for handling large data sets, as it provides built-in pagination and manages record retrieval in batches, keeping the view state small. Alternatively, manually adding a LIMIT clause to the SOQL query in a custom controller achieves a similar outcome by restricting the number of records returned, thus reducing both query time and view state size.
A. Standard picklists are indexed. Assuming the filter uses non-indexed fields is a premature conclusion; the core issue is the volume of data returned, not necessarily the filter field type.
B. The transient keyword reduces view state by excluding a variable from serialization. Removing it would worsen the "Maximum view state size limit exceeded" error.
C. Splitting the page does not solve the underlying problem. The controller would still fetch a large dataset, causing the same performance and view state issues on the results page.
1. Salesforce Apex Developer Guide, "Working with Large Sets of Data," section on StandardSetController. It explicitly states, "Standard set controllers... allow you to create list controllers that can display and act on a set of records, such as in a list page with pagination."
2. Salesforce Visualforce Developer Guide, "Best Practices for Improving Visualforce Performance," section "Reduce View State". It recommends using StandardSetController or limiting data to reduce view state.
3. Salesforce SOQL and SOSL Reference, "LIMIT Clause". The documentation describes how LIMIT restricts the number of rows returned, which is a direct way to control data volume.
Keep practicing
Take the free Plat-Dev-301 practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other Plat-Dev-301 practice questions
- Question 1Which use case can be performed only by using asynchronous Apex?
- Question 2The Account object has a field, Audit_Code__c, that is used to specify what type of audit…
- Question 3How should a developer verify that a specific Account record is being tested in a test cl…
- Question 5A developer created and tested a Visualforce page in their developer sandbox, but now rec…
- Question 6Refer to the code below: Lightning Web Component JS file JavaScript import {LightningElem…
- Question 7A developer is developing a reusable Aura component that will reside on an sObject Lightn…
