Salesforce limits the  maximum number of rows that can be returned by a SOQL query to 50,000 records. If such number is exceeded, a runtime exception is thrown. As a best practice developers should always use either a WHERE or a LIMIT clause, so  that the maximum number of records retrieved is capped.


  • Apex classes and triggers


  • This rule is not applied to test methods

Did this answer your question?