Here at Universidade Federal de Santa Catarina we are starting the upgrade of our infra-structure to 2.0 and our first major goal is to sync users from the academic control system.
In Moodle 1.9 we use a custom system, developed from beggining, and with a lot of features. One of these is to create users in Moodle from a table, and now we know that Moodle's External Database Authetication plugin can do the work, but it is not that "performatic".
As the documentation says, it uses arrays to calculate the set of users to be created, instead of a temporary table and a left join like what is done in ldap plugin.
This patch i am submitting changes this behaviour and introduces the temporary table in the proccess. A lot of duplicated code from ldap, that we may think about refactor.
I haven't tested the original process, but the new one can calculate the users to create in almost zero time in a fresh install (just 2 or 3 records in user table) and it took about 5 minutes to calculate the set with 38K records in the external table that were already in moodle.
Also, the update process can be a lot improved. The current code does an update for each user, that consists of one SELECT and N updates, where N is the number of update keys. I don't have numbers but should be better to construct only one UPDATE TABLE query and let the database calculate which records differ. This is valid for remove/suspend process too.