What are the advantages/disadvantages of querying moodle's database directly, when running a script? the script has to search/compare usernames between moodle and an external source. Around 25 k records.
The advantage is the direct DB access is the fastest possible way to do this.
The disadvantage is that you have to know what the data in the Moodle database means. Also, if the Moodle DB structure ever changes it will break your script until you fix it.