We have installed Moodle 4.1 on two virtual servers - one for Postgres, the other one for Moodle on Apache. We upgraded it several times so now it's 4.3 version. Each server has 32GB RAM and 4 CPU cores. I noticed that some functions take a long time. For example, enrolling 1000 users takes about 20 seconds, and unenrolling about 50 seconds when no one is using the system. I wonder what will happen when we try this with 20.000 users. We analyzed what is going on under the hood and found that there are thousands of cursors opening on the database, each performing about ten queries so there are tens of thousands of SQL queries executing sequentially and that takes time of course.
Is there anything we can do about this performance issues? Can those queries be somehow grouped or optimized or something?
