Governor Limits Flashcards
What are “Limits”?
Maximums that are set for different features on the platform and cannot be exceeded
What are “Allocations”?
Can be increased because they are the maximums determined by the edition of Salesforce that a customer has purchased
What are “Limitations”?
Non-existent characteristics of features and tools, ex. Limitation of the Schema Builder
Why use Governor Limits?
- cloud based multi-tenant
- need to prevent one company from using too much resource
- helps us write more efficient code
if exceeded we get an exception that rolls back any changes that would’ve been made
What are some limits of SOQL?
- In a single transaction, we can
- execute at most 100 synchronous SOQL queries
- execute at most 200 asynchronous SOQL queries
- execute at most 300 synchronous SOQL subqueries
- return no more than 50,000 records from all queries collectively
- We can avoid these limits by
- using selective queries so that only only the records we want are returned
- keeping queries out of loops
- returning lists of records rather than individual records
What are some limits of SOSL?
more restrictive than SOQL
- single transaction can only execute 20 SOSL
- each SOSL search returns up to 2,000 record
We can avoid these limits by
- keep out of loop
- return multiple records not individual
- use filter clauses for selective search
What are some limits of “DML?
Limits
- 150 DML per transaction
- 10,000 record per operation
Avoid
- avoid loop
- act on list of records not individual
- achieve this via using DML on collection not loop
What is the heap size limit?
- a 6 MB synchronous heap or 12 MB asynchronous heap
- we can avoid this by using SOQL for loops
CPU limit?
10 seconds of synchronous
or
60 seconds of asynchronous
10 minutes of execution time for a single transaction
Execution time limit?
10 minutes for a single transaction
What is the difference between the get%() and getLimit%() limit class?
get%() - how much of a governed operation we’ve used
getLimit%() - return limit on that governed operation
What is the difference between the get%() and getLimit%() limit class?
get%() - how much of a governed operation we’ve used
getLimit%() - return limit on that governed operation