The limit with regards to rows in a query locator is 50 million. Does using an inner query reduce the number of possible rows? For example:

Query for Query Locator:

FROM Account

As you can see every account row will contain a list of orders. I am just wondering whether that list of orders will decrease my account rows retrieval which is 50 million.


1 Answer 1


Based on this answer:

In a single transaction, you can have up to 300 parent-child subqueries. Each row returned by a parent-child subquery does count towards the 50,000 query row governor limit.

More details from the official site

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 limit for subqueries corresponds to the value that Limits.getLimitAggregateQueries() returns. The row counts from these relationship queries contribute to the row counts of the overall code execution. This limit doesn’t apply to custom metadata types. In a single Apex transaction, custom metadata records can have unlimited SOQL queries. In addition to static SOQL statements, calls to the following methods count against the number of SOQL statements issued in a request: Database.countQuery, Database.getQueryLocator, Database.query

  • by using the query locator the row limit is bypassed and we can go to 50 million rows. I was thinking that the parent-child subqueries might be also bypassed. Commented Jul 11, 2018 at 8:56

You must log in to answer this question.

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