7

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.

1 Answer 1

10

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.

2
  • 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
    Commented Jul 18, 2016 at 15:47
  • @s_saiyan yes you are correct here. Commented Jul 19, 2016 at 5:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .