SOQL inside a loop

Salesforce being a multi-tenant cloud platform, monitors each tenant's (organization's) process load, data usage, and so on to ensure that no tenant can cause an impact on the other tenants' processes. To achieve this, Salesforce imposes governor limits. Governor limits define the system usage allowance available to each tenant and ensures that any tenant crossing those limits is restricted to further impact the system. One such transaction level Apex limit is total number of SOQL queries issued in a single request. At present, the limit is 100 for synchronous transactions (Apex methods and triggers) and 200 for asynchronous transactions (batch Apex, future methods, and so on). So, if your code issues even one extra SOQL than ...

Get Apex Design Patterns now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.