A SOQL query can return a maximum of 50,000 records, is there any limit on the number of child records that can be fetched in a SOQL query.

Example, I have an Account name as 'DBZ' having more than 50,000 contacts. So will below query can hit any governor limit ?

List<Account> acc_Contacts = [Select name, (Select id, name from Contacts) from Account where name = 'DBZ']

Since i am having a developer edition org, i cant check it myself for this amount of data.


Yes it will because the 50,000 record count in single transaction.

As per Execution Governors and Limits:

In a SOQL query with parent-child relationship subqueries, each parent-child relationship counts as an extra query. These types of queries have a limit of three times the number for top-level queries. The row counts from these relationship queries contribute to the row counts of the overall code execution.

  • So for a given record i can fetch a max of 49999 child rows records, since 1 row will be for parent record itself. Please throw some light !!
    – s_saiyan
    Jul 18 '16 at 15:47
  • @s_saiyan yes you are correct here. Jul 19 '16 at 5:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.