I would like to calculate rates based on sets of Opportunities returned from a query -- this query regularly returns way more than the 50k limit allowed. At a high level, I know that I can get around that limit by moving this logic into a Batch context. The problem is, I'm not sure how to do it given what my query logic is. I basically have to query all Opportunities, i.e. "FROM Opportunity", but I'm also performing a subquery to grab all OpportunityLineItems underneath each opp.
I've been looking for examples online but I'm not finding any. Does anyone know what the nuances are behind querying more than 50k records for a query that has a subquery in it -- and how this works in a Batch context?
Again, I need to have all the opp records and their child records, and then calculate a list of rates based on that full list. So I can't calculate the rates in each individual batch per se.
I appreciate any help. If I should provide more detail, let me know. Thank you.