-1

What is the difference between Database.QueryLocator and Iterable in Batch Apex?

Which one is best?

1 Answer 1

9

The biggest difference is probably that an Iterable can loop over aggregate queries and types which aren't even in the database. You could batch over letters in the alphabet, days in the last year, callout results, etc.

Another notable difference is the QueryLocator can return millions of rows for a batch, whereas the Iterable can only pull in the synchronous query limit.

0

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