PDI · Question #59
The following code snippet is executed by a Lightning web component in an environment with more than 2,000 lead records: Which governor limit will likely be exceeded within the Apex transaction?
The correct answer is C. Total number of records retrieved by SOQL queries. When an Apex method queries a large number of records from an object like Lead, the "Total number of records retrieved by SOQL queries" governor limit can be exceeded if the query attempts to fetch more than 50,000 records in a single transaction.
Question
The following code snippet is executed by a Lightning web component in an environment with more than 2,000 lead records:
Which governor limit will likely be exceeded within the Apex transaction?
Exhibit
Options
- ATotal number of DML statement issued
- BTotal number of SOQL queries issued
- CTotal number of records retrieved by SOQL queries
- DTotal number of records processed as a result of DML statements
How the community answered
(30 responses)- A17% (5)
- B7% (2)
- C73% (22)
- D3% (1)
Why each option
When an Apex method queries a large number of records from an object like Lead, the "Total number of records retrieved by SOQL queries" governor limit can be exceeded if the query attempts to fetch more than 50,000 records in a single transaction.
Executing a SOQL query does not involve DML (Data Manipulation Language) statements, so the limit on the total number of DML statements issued would not be affected.
A single SOQL query, regardless of the number of records it retrieves, only counts as one SOQL query against the limit of 100 SOQL queries issued.
The governor limit for the total number of records retrieved by SOQL queries is 50,000. If the Lightning web component executes an Apex method that performs a SOQL query to fetch all lead records and the environment contains more than 50,000 leads, this limit will be exceeded.
The limit on the total number of records processed as a result of DML statements applies to DML operations (insert, update, delete, upsert), not to SOQL queries.
Concept tested: SOQL governor limits (records retrieved)
Source: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_gov_limits.htm
Topics
Community Discussion
No community discussion yet for this question.
