You need to sign in to do that
Don't have an account?
vijendahr k
SOQL query size issue in Parent child query.
Hello All,
I have SOQL Query as follows
list<account> acclist= new list<accout>[SELECT Id,(SELECT Id FROM Opportunities) FROM Account limit ]
Now account have 3 records each child have 3 records. now tell me some one the list of acclist size will be 3 or 9.
I had scenario where i have query like [parent,(child)(child)(child)] in this query parent getting 1500 or bit more records. even though i am getting error like more then 50,000 in query.
Can some one please answer my query. - Thanks Advance.
I have SOQL Query as follows
list<account> acclist= new list<accout>[SELECT Id,(SELECT Id FROM Opportunities) FROM Account limit ]
Now account have 3 records each child have 3 records. now tell me some one the list of acclist size will be 3 or 9.
I had scenario where i have query like [parent,(child)(child)(child)] in this query parent getting 1500 or bit more records. even though i am getting error like more then 50,000 in query.
Can some one please answer my query. - Thanks Advance.
In a SOQL query with parent-child relationship sub-queries, each parent-child relationship counts as an additional query.
to understand in details refer below link :
https://salesforce.stackexchange.com/questions/66083/soql-how-to-handle-relationship-query-with-more-than-50-000-results
i hope it helps you.
Let me inform if it helps you and kindly mark it best answer if it helps you so it make proper solution for others
thanks
sfdcmonkey.com
i know you blog. its helped some times, thanks for sharing new things :)
you can check the acclist list size using the system.debug(acclist.size());
and you should look at using Batch Apex to achieve your goals.
You cannot retrieve more than 50,000 records your SOQL calls in a single context.
However, with Batch Apex your logic will be processed in chunks of anywhere from 1 to 200 records in a batch.
You'd need to modify your business logic to take the batching into account if necessary.
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_batch_interface.htm
here is the Execution Governors and Limits reference :
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_gov_limits.htm
Hops it will helps you Let me know
Thanks