DML Statements: DML (Data Manipulation Language) statements are used to insert, update, or delete Salesforce data. A single Apex transaction can execute a maximum of 150 DML statements. This limit is in place to prevent Apex code from making too many database changes and impacting the performance of other users.
CPU Time: CPU time is the amount of time that a process can use the CPU. A single Apex transaction can consume a maximum of 5 minutes of CPU time. This limit is in place to prevent Apex code from monopolizing the CPU and impacting the performance of other users.
Memory Usage: Memory usage is the amount of memory that a process can use. A single Apex transaction can use a maximum of 100MB of memory. This limit is in place to prevent Apex code from using too much memory and impacting the performance of other users.
Concurrent Apex Executions: A concurrent Apex execution is an Apex transaction that is currently running. A single user can have a maximum of 10 concurrent Apex executions. This limit is in place to prevent a single user from monopolizing the Apex runtime and impacting the performance of other users.
API Callouts: API callout is a method of calling an external web service from within an Apex transaction. A single Apex transaction can make a maximum of 100 callouts to an HTTP request or an API call. This limit is in place to prevent Apex code from making too many external calls and impacting the performance of other users.
Asynchronous Apex Executions: Asynchronous Apex executions are Apex transactions that run in the background. A single user can have a maximum of 100 asynchronous Apex executions in progress. This limit is in place to prevent a single user from monopolizing the asynchronous Apex runtime and impacting the performance of other users.
These limits are enforced by Salesforce to ensure that Apex code does not monopolize system resources and impact the performance of other users. If an Apex transaction exceeds a governor limit, an exception will be thrown and the transaction will be terminated.
There are a few things that you can do to avoid hitting governor limits:
Use SOQL queries sparingly and only when necessary.
Use bulk API calls to
insert, update, or delete large amounts of data.
Optimize your Apex code to
minimize the amount of CPU time and memory that it uses.
Use asynchronous Apex
executions to run long-running tasks in the background.