Most of us know this is a very basic question but I little confused here again, As per the documentation here, it says that parent-child query row count is added to the overall row count in the execution context(50000).
But when I executed below code and while verifying the limits,
I found the record count of the child sub-queries isn't added to total row count. Not sure I'm checking wrongly or salesforce has made some changes in this area some time back.
(In Execute anonymous window)
system.debug('Limits.getLimitAggregateQueries() '+Limits.getLimitAggregateQueries());
system.debug('Limits.getLimitQueries() '+Limits.getLimitQueries());
system.debug('Limits.getLimitQueryRows() '+Limits.getLimitQueryRows());
for(Account acc : [select id,name,
(Select id,name from contacts limit 10),
(Select id,name,Product_Quantity__c from Customer_Order__r limit 10)
from Account
WHERE
ID IN ('0019000001RiFFI', '0019000001LELy9')]){
system.debug('acc name: '+acc.name);
system.debug('acc Contacts: '+acc.contacts.size());
system.debug('acc customer orders: '+acc.Customer_Order__r.size());
}
system.debug('Limits.getAggregateQueries() '+Limits.getAggregateQueries());
system.debug('Limits.getQueries() '+Limits.getQueries());
system.debug('Limits.getQueryRows() '+Limits.getQueryRows());
In debug logs
If these child sub-query records count is not added to total row count(50000) in execution context, Do these are added to Aggregate query row limits? Or what does it mean ?
These types of queries have a limit of three times the number for top-level queries
How this below statement can be true in contrast with above screenshot result,
"In a SOQL query with parent-child relationship subqueries, each parent-child relationship counts as an extra query."
But It shows as only one query consumed in above screenshot.
SF docs link here