[SalesForce] Difference between Database.executeBatch vs System.scheduleBatch

I am curious to know is there any notable difference between Database.executeBatch vs System.scheduleBatch. One difference I know is, we can delay the batch execution in scheduleBatch method. However, I did not find any performance related documents.

Anyone have experienced any performance difference with these methods?

Best Answer

The performance of all Batch Apex (all asynchronous Apex, really) can vary based on system load. That applies regardless of whether the batch is enqueued immediately or with a time delay, based on the load when execution actually happens.

The extra wrinkle with System.scheduleBatch() is that scheduled job limits apply at the time of scheduling, while normal batch Apex limits are applied once the schedule fires and enqueues the batch job:

All scheduled Apex limits apply for batch jobs scheduled using System.scheduleBatch. After the batch job is queued (with a status of Holding or Queued), all batch job limits apply and the job no longer counts toward scheduled Apex limits.

You also don't have to implement Schedulable in your batch class if you're only using one-off scheduling with System.scheduleBatch().