I have a requirement where I'm getting more than 50k records for a single parent id, and I need those whole records to process them.

I now batch is the best option to use but that would be time taking process. I just wanted any logic by which I can get more than 50k records and use that.

It is an urgent requirement, please share valuable answers.



There is no way to load more than a total of 50K records in a given synchronous session/transaction (as per the documentation), and certainly no way to do this in a trigger. The only way to deal with this sort of thing is to use async processing such as in a Batchable as you mentioned.

It is possible to execute certain types of aggregate query across more records, but from what you said this approach isn't appropriate for you.

NB: Being executed from a trigger implies that you are unable to use a readonly transaction to get a higher limit.

| improve this answer | |
  • Is there any way like if get total records which going to be retrieved from Count() and by using anything OFFSET, I first get 50k records and next by skipping 50k which already I got? – ANKIT SHARMA Jan 23 at 8:52
  • @ANKITSHARMA Unfortunately no, the 50.000 records is for the entire transaction which means you don't get to query more records after that. – Kasper Jan 23 at 9:51

Not the answer you're looking for? Browse other questions tagged or ask your own question.