So I have a query that is returned more than 50,000 results. Its just a query on contacts. But Im not sure how to limit the query and then continue getting the rest of the results. I was considering this.
- Running the query with limit 50,000 ordered by Id.
- If the results number less than 50,000, break and continue
- If more, run the query again but where Id greater than the 50,000th one I got back in my previous run.
Would that work? ordering by Id and then doing greater than? If not can someone tell me how I manage this?
I know the easiest thing to do here would be test, but we dont have an org set up for this case, so someone has to go and set it up. So while Im waiting I figured Id ask to see if im on the right track.