function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sanket BhosleSanket Bhosle 

What will contribute to the Total number of records retrieved by SOQL queries?

Hi all,

I have the following query :

Select id, (Select Name , email from contacts where email != null), (Select name,stagename from Opportunities where stagename = 'Closed Won') from Account where id in (select accountid from contact where email!=null) and id in(select accountid from opportunity where stagename = 'Closed Won') 

I wish to know if the governor limit for fetched records includes only accounts, child contacts and child opportunities or will it include the All contacts and opportunities mentioned in the where clause as well.

Thanks.
Deepak Pandey 13Deepak Pandey 13
Hi Sanket,
    Governor limit only consider parent object.
List<Account> lstAcc = [Select id, (Select Name , email from contacts where email != null), (Select name,stagename from Opportunities where stagename = 'Closed Won') from Account];
v varaprasadv varaprasad
Hi Sanket,

If we run below query it will consider as 1 query.
But it will count all rows means paren and child.
Ex : 
An account having two contacts and one opportunity. So here rows count is 4.
 
List<Account> lstAcc = [Select id, (Select Name , email from contacts),
                            (Select name,stagename from Opportunities)
                            from Account where id = '0010I00001fW0cG'];

Governor Limits

Hope it helps you.

Thanks
Varaprasad