Skip to main content

I'm trying to figure out if I can use DLRS when there could be more than 50,000 child records for a given parent -- will this process rollups across batches.  

 

It seems that the scheduled / run now jobs are batched, as we can set a batch size, but the documentation references capturing >50K records among several parents:

 

 

"Why am I receiving this error “System.LimitException: dlrs:Too many query rows: 50001”

DLRS usually queries from the perspective of the parents, retrieving all of the child records that match the given criteria. If the parents in a given batch have an average of 250 (50,000 / 200) children, have many DLRS jobs configured, or have lots of cascading rollups (rollup from grandchild to parent to grandparent) then DLRS can easily request a total of >50,000 records in the given transaction.

If this is happening during a scheduled calculation or a full calculation batch job then you can adjust the batch size in the Declarative Lookup Rollup Summaries hierarchy custom setting. It defaults to 200." 

 

I've looked but haven't found anything definitive yet so thought the group could help! 

7 answers
  1. Jul 10, 9:46 PM

    @Jennifer Carneiro

    Salesforce makes special exceptions for "Count" actions. 

     

    In my scratch org I created 52,000 Contacts attaches to an Account. 

     

    If I run "SELECT AccountId, COUNT(Id) FROM Contact GROUP BY AccountId" then Salesforce will let it run and succeed. If I change it to "SELECT AccountId, MAX(CreatedDate) FROM Contact GROUP BY AccountId" then it throws the error "Too many query rows: 50001". (Run using Anonymous Apex) 

     

    So the good news is your specific case gets a pass but something slightly different would cause it to fail.

0/9000