How to select a lot of topics fast?

When using on Enterprise you gotta get your hands dirty sometimes.

I have a need to sync groups with employee groups, with more than 10k users a day. We just drop to database and update users groups accordingly.