Skip to main content
Data access in loops

Prevent the use of any SOQL or DML inside loops to help your application cope with larger volumes of data properly.

Lorenzo Frattini avatar
Written by Lorenzo Frattini
Updated over 6 years ago

Rationale

Salesforce enforce a  limit on the number of SOSL and DML statements per transaction. Reading or writing data inside loops is highly likely to hit such limits.  

Scope

  • Apex classes and triggers

Did this answer your question?