As part of the Artisan Hub processing (global directory of Certified Salesforce Professionals) we need to run a daily process which assigns everyone a rank based on their total Artisan Hub points.
This has been working fine but the volume of Contacts (coming up to 120,000) started causing the batch apex code to hit governor limits about a week ago and the code now needs to be re-factored.
I'm wondering if anyone has a good strategy for processing this number of contact records in the right order?
Currently the code uses scheduled batch apex with a "next rank" value as a stateful class attribute. The main query used by the batch class sorted all the contacts into order.
What I've found is that whilst it appears watching the Apex Jobs page that the system is processing one batch at a time, they do not appear to be getting processed in the order imposed by the ORDER BY clause.
If batch Apex won't honor the sort order set in the batch query does anyone have a suggestion about how to batch process 120,000 contacts? Apart from exporting via the bulk API and updating outside of the Salesforce Platform!