Candidates must read debug logs, identify the specific governor limit being hit, and refactor code to bulkify, reduce queries, and use selective indexed SOQL. The single most important skill is eliminating per-record SOQL/DML inside loops.
Start practicing
Performance — choose a session length
Free · No account required
Domain overview
The Performance domain of the Salesforce Certified Platform Developer II exam covers diagnosing and fixing governor-limit and scalability problems in Apex, SOQL, and triggers. Questions present debug logs, CPU or heap limit failures, and large-data query scenarios, asking you to identify the root cause and select the optimization that keeps transactions within Salesforce limits.
Exam objectives
Reading debug logs to pinpoint CPU, heap, and SOQL query limit violations in Apex transactions
Using selective SOQL filters, indexed fields, and query plans to avoid full-table scans on large objects
Bulkifying Apex triggers and using Trigger.newMap to avoid per-record DML and SOQL inside loops
Applying Asynchronous Apex (Queueable, Batch, Future) to offload long-running or high-volume processing
Putting SOQL or DML inside a for loop, which quickly exhausts governor limits instead of bulkifying with collections
Assuming all fields are indexed; custom fields need custom indexes and formula fields cannot be indexed at all
Ignoring selective query filters, causing full-table scans and timeouts on large data volumes
Click any question to see the full explanation and answer options, or start a focused practice session above.
A developer has a requirement to update 5,000 records in a single transaction. The operation frequently hits the 'Too many DML statements' limit. What is the most efficient way to refactor the code?
2A developer needs to update a field on 50,000 child records based on a change in a parent Account. What is the most performant way to handle this update?
3A developer is building a high-performance REST API integration. Which of the following is the most important practice for ensuring the integration handles high throughput?
4Refer to the exhibit. The Apex transaction is consistently hitting the CPU limit. What is the most likely cause and the best way to optimize the code?
5A developer is writing a query to fetch related records. Which SOQL pattern is best for avoiding unnecessary query execution and improving performance?
6A developer needs to aggregate data from 10 million rows. Which approach is the most efficient for preventing governor limit issues?
7A developer is writing an Apex trigger that should only fire when specific fields are changed. Which THREE practices help optimize the trigger's performance?
8A developer is writing a batch Apex class to process 50,000 Account records. To ensure optimal performance and avoid hitting governor limits, which strategy should be implemented regarding DML operations?
9Refer to the exhibit. The query is performing poorly on an object with 5 million records. What is the most likely cause, and how should it be addressed?
10A developer is building a search feature that must query across multiple objects. What is the most performant approach to searching for a term that might exist in any field?
11A developer wants to minimize the impact of long-running operations on the user interface. Which design pattern should they utilize?
12When designing a high-performance integration, what is the best practice for handling data updates to avoid record locking issues?
13Which THREE factors contribute to slow execution of SOQL queries in Salesforce?
14An Apex trigger is failing due to a 'System.LimitException: Too many DML statements: 151'. What is the optimal refactoring approach?
15What is the primary benefit of using a Platform Cache for application data?
16An enterprise Salesforce application requires high-performance execution of complex SOQL queries across millions of records. Which strategy should a developer implement to ensure optimal query performance and prevent governor limit violations?
17A developer needs to improve the performance of a report that queries millions of records across several custom objects. The architect suggests using Skinny Tables. Which TWO statements correctly describe the benefits and limitations of Skinny Tables? (Choose two.)
18A developer wants to use Platform Cache to improve the performance of a high-traffic Visualforce page that performs expensive SOQL queries and calculations. The data is specific to each user and should persist across multiple requests within the same session. Which type of cache should the developer use?
19Refer to the exhibit. A developer is reviewing a debug log for a failed transaction. What is the primary performance issue identified in the log snippet?
20A developer is writing an Apex trigger on the Account object that performs a SOQL query inside a loop to retrieve related Contacts. To adhere to performance best practices and avoid governor limits, what is the most efficient pattern to implement?
21A developer is building a Visualforce page that displays a custom object's related list with 5,000 child records. The controller currently performs a SOQL query inside a getter method that is called multiple times during page rendering, and users report the page takes over 30 seconds to load. The developer needs to improve performance without changing the page's functionality. Which approach should the developer take?
22A developer is building an Apex batch job that processes 50,000 Account records. The batch class uses `Database.executeBatch` with a batch size of 200. After running the job, the developer notices that the job takes significantly longer than expected and sometimes fails with `UNABLE_TO_LOCK_ROW` errors on the Account object. What is the most likely cause of the performance degradation?
23A developer is optimizing a Visualforce page that displays a large list of Opportunities with related OpportunityLineItems. The page currently uses a standard controller with an `<apex:pageBlockTable>` and a SOQL query in the controller that retrieves all Opportunities and their line items. The page loads slowly and sometimes hits governor limits. Which two strategies should the developer use to improve performance? (Choose two.)
24A developer is designing a solution to calculate real-time statistics on a high-volume custom object, `Sensor_Reading__c`, which receives thousands of new records per hour. The statistics must be displayed on a Lightning Web Component (LWC) dashboard and must reflect the most recent data within 5 minutes. The developer considers using a scheduled Apex job to aggregate data every 5 minutes, but the aggregation query takes longer than 5 minutes to run. What is the most appropriate approach to meet the performance requirement?
25A developer is reviewing a custom Lightning Web Component that displays a list of 10,000 Contacts. The component uses a wire adapter to call an Apex method that returns all Contacts in a single response. Users report that the component loads very slowly and sometimes freezes. What is the most effective way to improve the component's performance?
26A developer is building a Lightning Web Component that needs to display a list of 200 accounts with their annual revenue, and the component's Apex controller currently executes a SOQL query inside a loop over the accounts to fetch related opportunities. Users report slow load times. What is the most effective way to improve performance?
27A developer is optimizing a Visualforce page that displays a table of 1,000 custom object records. The page uses a StandardSetController and currently loads all records at once, causing slow rendering. The developer wants to implement pagination to improve performance. Which approach should be used?
28A developer has built a Lightning Web Component that calls an Apex controller method to retrieve a list of Opportunities for a given Account. The SOQL query uses an indexed field on the Opportunity object, but the query still times out for Accounts with over 100,000 related Opportunities. The developer wants to improve performance by reducing the amount of data transferred and processed. Which approach should the developer take?
29A developer is building an Apex batch class that processes 2 million Account records. The start method uses the following SOQL query: [SELECT Id, Name FROM Account WHERE BillingCountry = 'US']. The query is selective because BillingCountry is indexed. However, during testing, the batch job fails with a 'First error: Apex CPU time limit exceeded' error. The developer suspects that the issue is related to the query performance. Which of the following is the most likely cause of the CPU timeout?
30A developer is optimizing a complex Apex transaction that processes a large number of records. The transaction currently performs multiple SOQL queries and DML operations inside loops. Which two strategies should be used to improve performance and avoid governor limit errors? (Choose two.)
31A 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?
32A developer is writing an Apex trigger that updates a related object's records when a parent record is updated. The trigger currently performs a SOQL query for each child record to check if an update is needed. What is the most efficient way to optimize this trigger?
33A developer is building a Visualforce page that displays a table of 1,000 Contact records. The page uses a standard controller with an extension that queries all Contacts in the constructor. Users report that the page loads slowly. Which change should the developer make to improve performance?
34A developer is optimizing a Visualforce page that displays a large dataset using a StandardSetController. The page currently loads slowly because it queries all records at once. The developer wants to implement pagination to improve performance. Which approach should be used?
35A developer is optimizing a complex SOQL query that joins multiple custom objects. The query is used in a trigger and is causing CPU time limit exceptions. The developer notices that the query is not using any indexes. What is the most likely cause?
36A developer is building an Apex controller for a Visualforce page that must display a list of 2,000 Contacts for an Account. The current implementation uses a SOQL query inside a loop to fetch Contacts for each Account row, resulting in sluggish page loads and occasional governor limit errors. Which approach should the developer take to improve performance?
37A developer is writing a trigger on a custom object that processes up to 200 records at a time. The trigger currently performs a SOQL query inside a loop to retrieve related records for each record. This causes the trigger to hit governor limits. What is the best practice to refactor the trigger for performance?
38A developer is building a Lightning Web Component that displays a list of Accounts with their related Contacts. The component currently performs a separate SOQL query for each Account to retrieve its Contacts, resulting in 200 queries when 200 Accounts are displayed. The developer wants to reduce the number of queries to improve performance and avoid hitting governor limits. Which approach should be used?
39A developer is building an Apex trigger that processes 200 Opportunity records on insert. The trigger needs to query all related OpportunityLineItem records to calculate a total. To avoid hitting the SOQL query limit, which approach should the developer use?
40A developer is optimizing an Apex trigger that processes a large number of records. The trigger currently performs a SOQL query inside a loop to check for duplicate records. This causes a 'Too many SOQL queries: 101' error when more than 100 records are processed. What is the best way to refactor the trigger to avoid this error?
41A developer is writing a SOQL query on a custom object with 5 million records. The query filters on a custom field that is not indexed and returns a large number of records. The query is running slowly and sometimes fails with a 'Non-selective query' error. What should the developer do to improve query performance?
42A developer is optimizing a Visualforce page that displays a large list of Accounts with related Contacts. The page currently uses a standard controller with an <apex:pageBlockTable> and a controller extension that queries all Contacts for each Account in a loop. Users report that the page loads slowly and sometimes times out. Which technique should the developer implement to improve performance?
43A developer is optimizing a Visualforce page that displays a list of accounts with their related contacts. The page uses a standard controller with an extension and a repeater component. The developer notices that the page is slow when there are many accounts, each with several contacts. What is the most likely cause of the performance issue?
44A 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?
45A developer is building a batch Apex class to process 1 million records. The class implements Database.Batchable and uses a SOQL query in the start method. During testing, the developer notices that the batch job fails with a 'First error: Exceeded maximum number of SOQL queries' error. What is the most likely cause and how can it be resolved?
46A developer is optimizing an Apex class that performs a large number of DML operations. The class currently updates records one at a time in a loop. Which two techniques should be used to improve performance? (Choose two.)
47A developer is optimizing an Apex trigger on the Opportunity object that updates related OpportunityLineItem records. The trigger currently performs a SOQL query for each OpportunityLineItem to check a field on the parent Opportunity. This causes performance degradation and governor limit errors. Which technique should the developer use to improve performance?
48A developer is building an Apex trigger on a high-volume custom object that must update a related child record whenever a parent record's Status__c changes. The trigger runs for both single-record UI edits and bulk API loads of 200 records. The developer wants to avoid a per-record SOQL query inside the trigger loop. Which approach is the most performant and scalable?
49A developer has a Lightning Web Component that calls an Apex controller method returning 5,000 Account records to render in a custom table. Users report the component takes several seconds to become interactive. The developer wants to reduce the initial payload and rendering time. Which change is the most effective?
50A developer maintains an Apex class that performs a callout to an external REST service and then writes the response into Salesforce records. The callout occasionally takes longer than expected, and the developer wants to ensure the transaction can recover gracefully without leaving partial data. Which approach best addresses this?
51A developer is troubleshooting a Lightning Web Component that calls an Apex method returning many records and notices the component re-fetches the same data every time the user navigates back to the tab. The developer wants to avoid redundant server calls for read-only data. Which change should be made?
52A 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.)
53A developer is optimizing a Visualforce page that displays a large table of Opportunity records. The page uses a StandardSetController and iterates over the records to display fields. Users report that the page loads slowly, and the developer notices that the page makes a SOQL query for each Opportunity to retrieve the Owner's Name. The developer wants to improve performance by reducing the number of queries. What is the most efficient way to achieve this?
54A developer is writing an Apex trigger on the Case object that updates a custom field on the Account when a Case is closed. The trigger currently performs a SOQL query to retrieve the Account for each Case in Trigger.new. The developer wants to optimize the trigger to handle bulk updates of up to 200 Cases without hitting governor limits. What is the best practice to achieve this?
55A developer is optimizing a Lightning Web Component that displays a list of 500 custom object records. The component uses a wire adapter to call an Apex method that returns the records. The Apex method currently queries all fields on the custom object, including several rich text fields and formula fields that are not displayed in the component. Users report that the component takes a long time to load. What should the developer do to improve the performance of the Apex method?
Candidates must read debug logs, identify the specific governor limit being hit, and refactor code to bulkify, reduce queries, and use selective indexed SOQL. The single most important skill is eliminating per-record SOQL/DML inside loops.
The Courseiva SF-PD2 question bank contains 55 questions in the Performance domain. Click any question to see the full explanation and answer breakdown.
Start with a 10-question focused session to identify your baseline accuracy in this domain. Read every explanation — even for questions you answer correctly — to understand the reasoning. Once you score consistently above 80%, move to a 20–30 question session to confirm depth before moving to the next domain.
Yes — the session launcher on this page draws questions exclusively from the Performance domain. Choose 10, 20, 30, or 50 questions for a focused session, or click individual questions to review them one by one.
Save your results, see per-domain analytics, and get readiness scores — free, for every certification.
Sign Up FreeFree forever · Every certification included