10

People tend to lump "batch" and "scheduled" Apex together, given that the former is often invoked from the latter. The way they're talked about, it's easy to think that they are both examples of asynchronous Apex.

This made me wonder, is scheduled Apex, all by itself, considered synchronous or asynchronous? More importantly, does scheduled Apex use synchronous or asynchronous governor limits?

1 Answer 1

9

Scheduled Apex uses synchronous governor limits.

To confirm this, I created and scheduled an Apex class with one purpose: executing SOQL queries until hitting the governor limit. The job failed (as expected) with the reason, "Too many SOQL queries: 101".

Screen shot from the Apex Jobs monitoring page, showing the "Too many SOQL queries: 101" exception message

As of Winter '15, the synchronous limit on SOQL queries is 100, and the asynchronous limit is 200. Failing at query #101 demonstrates that scheduled Apex uses synchronous governor limits.

2
  • note that scheduled apex is frequently used to launch Batchable Apex classes which will execute under async limits
    – cropredy
    Nov 8, 2014 at 2:27
  • Exactly right, @crop1645! That's why I think a lot of people assume that both scheduled AND batch Apex are async. I wanted to get confirmation that scheduled Apex was synchronous when it was running "all by itself". :-) Nov 10, 2014 at 2:28

You must log in to answer this question.

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