This way you will have the application retrieve all 13000 objects from the database and store them in MBS’s (Mendix Business Server) memory. This is what makes it slow. You can prevent this by doing this 1000 records at the time. Modify the retrieve activity like this:
After the loop, delete the processed objects, go back to the start, retrieve the next 1000 and keep going until you no longer find and objects:
And then test, test and test again. Loop need attention to become bugfree.
Forgive any misinterpretations that will make my solution
stupid not helpful, but you might prevent having to loop for every user separately by doing it like in my modified image.
For offloading to an asynchronous queue, you might need module Process queue, or upgrade to Mx9 and use task queue.