Salesforce Certified Platform Developer II — Question 168
Consider the following queries. For these queries, assume that there are more than 200,000 Account records. These records include soft-deleted records; that is, deleted records that are still in the Recycle Bin. Note that there are two fields that are marked as External Id on the Account. These fields are Customer_Number_c and ERP_Key_c.
Which two queries are optimized for large data volumes? (Choose two.)
Answer options
- A. SELECT Id FROM Account WHERE Name != '' AND IsDeleted = false
- B. SELECT Id FROM Account WHERE Id IN :aListVariable
- C. SELECT Id FROM Account WHERE Name != '' AND Customer_Number_c = 'ValueA'
- D. SELECT Id FROM Account WHERE Name != NULL
Correct answer: B, C
Explanation
Option B is optimized for large data volumes because it directly filters on a specific set of IDs, which is efficient in querying. Option C is also optimized as it utilizes an External Id field for filtering, which is indexed and improves query performance. Options A and D are less efficient, as they evaluate conditions on non-indexed fields, leading to slower query execution over large datasets.