Courseiva
Performance →hardMultiple Choice

SF-PD2 Performance Practice Question

A 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?

⚠ Common exam trap

The trap here is focusing on the Visualforce component type rather than the underlying query pattern that causes multiple database calls.

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

✓

The extension is querying contacts for each account inside a loop, causing a query per account.

The most likely cause is the N+1 query problem, where the extension queries contacts for each account individually. This results in many SOQL queries, slowing down the page and risking governor limits. The solution is to query all contacts in a single query and then associate them with accounts in memory, or use a relationship subquery. This reduces the number of queries to one or two, improving performance.

Answer analysis

Option-by-option breakdown

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

  • ✗

    The page is not using JavaScript remoting for data retrieval.

    Why it's wrong here

    JavaScript remoting can improve performance by reducing page size and enabling asynchronous calls, but it is not the only solution. The scenario describes a Visualforce page with a standard controller and extension, where the performance issue is likely due to query inefficiency. Switching to JavaScript remoting would require significant refactoring and might not address the root cause if the queries remain inefficient.

  • ✗

    The page is using a standard controller without a custom extension.

    Why it's wrong here

    A standard controller alone does not cause performance issues; it simply provides basic CRUD operations. The problem arises from how related records are accessed. Without an extension, you cannot add custom logic, but the scenario states an extension is used. So the lack of extension is not the cause; the issue is likely in the extension's query pattern.

  • ✓

    The extension is querying contacts for each account inside a loop, causing a query per account.

    Why this is correct

    Querying related records inside a loop results in multiple SOQL queries, leading to governor limit exceptions and slow performance. Each query adds overhead and can quickly exceed the 100 SOQL query limit. The correct approach is to use a single query with a relationship subquery or a separate query for all contacts and then map them to accounts in memory, avoiding the N+1 query problem.

  • ✗

    The page is using a repeater component instead of a data table.

    Why it's wrong here

    The choice between a repeater and a data table affects rendering and features, but not the number of queries. A repeater can be less efficient for large datasets, but the primary performance bottleneck in this scenario is likely the query pattern. Using a data table would not automatically fix the underlying query issue and might not be suitable for custom layouts.

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.