Too many query rows 50001 in batch class

Latest Posts Forums Project Scenarios Lightning Aura Component Too many query rows 50001 in batch class

Tagged: 

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #1526 Reply
    Admin
    Keymaster

    This error occurs when records queried are above 50k and hereby hitting the limits.

    #1527 Reply
    Admin
    Keymaster

    Causal queries can be several. One I encountered was when I skipped to use query locator in my batch apex.

    Represents the record set returned by Database.getQueryLocator and used with Batch Apex.

    Using string query was giving error though using ‘Database.QueryLocator’ and returning that as below solved the error.

    public Database.QueryLocator start(Database.BatchableContext bc){
    string accon = ‘Select ID,Name,(Select Id,Company__c FROM CONTACTS) From Account’;
    return Database.getQueryLocator(accon);

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: Too many query rows 50001 in batch class
Your information:




error: Content is protected !!