Adding a group to a user takes longer and longer the more users are in the group

Hello,

I’ve noticed that both the occ and HTTP REST command for adding a group to a user takes longer and longer the more users are in a group.

The commands:
occ group:adduser groupname userid
ocs/v1.php/cloud/users/userid/groups

I have now tried with 14k test users in a group and the execution time is almost 17 minutes to add that group to a single user (it’s like instant for small number and around 10 sec for 1-2k users).

If I run the command on a different group that have a low number of people the execution is fast so it looks like it is tied to the given group.

The web server and database server does not use all their resourses and they are using nextcloud 30.0.5 with mariadb on debian 12.

I’m wondering if more people have this problem or if I’m missing something?

I’ve also noticed that if I forceable stop the execution after like 1 second it looks like the user actually have the group in the “Accounts” admin page but I don’t know if the group is correctly added then. I can see that a post is added in the “oc_group_user” table but don’t know if there are more things that is done with the occ command. Might this be a workaround if that is all it does if someone knows?

Thanks in advance.