Looks like this was caused by a bug in my external database population program, not Moodle.
It seems for 1 type of course I was adding duplicate enrolments for teachers.
Hardware and performance
Slow logins for users and possible solution
This discussion has been locked because a year has elapsed since the last post. Please start a new discussion topic.