• Yosef Cadaner 5
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies

So I'm trying to do an aggregate query in Batch Apex and of course I'm running into the error "Aggregate query does not support queryMore(), use LIMIT to restrict the results to a single batch" which is useless since of course the whole idea of an aggregation is get everything you need without a LIMIT.

 

I tried using the scope parameter on database.executeBatch because the documentation implies that it changes the batch size so I tried 3,000 since that is the quantity of records I have, but I still got the querymore error.

 

It looks like aggregate queries really cannot be used in Batch Apex.  Oh sure, for 20 records maybe, but not for 200+, i.e. the real world.  Can anyone confirm that?

 

Also, what does the scope parameter on database.executeBatch really do?  Does it only throttle down the batch size, or can you use it to throttle up the size?  If so, then why doesn't it work for aggregate queries?

 

Thanks

David