1

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:

SELECT Id, (SELECT Id FROM Orders)
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
5

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

1
  • 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. Jul 11 '18 at 8:56

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.