Group Membership (sys_user_grmember) cleanup job advice

jMarshal
Mega Sage

I've noticed how we can get duplicate records in sys_user_grmember (same user/group combo existing on multiple records on this table). This happens because of automated processes that add members to groups without checking membership first, etc...but it happens and I want to manage this data better.

I was thinking of running a nightly script job or a flow which would delete these duplicate records, keeping the most recent one in all cases.


I do not need help with the script or flow, I got that covered...but I do want advice on my theory/thought process, if anyone has any.

I cannot imagine any negative down-stream effects which would come from deleting these duplicates...but I don't know of any oob platform features which may rely on this capability (having a user essentially be a member of a group "more than once"), that we will not be able to leverage in the future, which relies on this configuration choice....and I call it a "configuration choice" because it seems to me like it would otherwise be a good idea to include this type of maintenance oob without me needing to discover this and correct it...

...thoughts?

1 ACCEPTED SOLUTION

Rampriya-S
Kilo Sage

Hi @jMarshal, I’d recommend de-duplicating the table first and then creating a unique database index on the user and group columns. That will prevent duplicate memberships from being created at the database level going forward and eliminate the need for ongoing cleanup.

RampriyaS_0-1766081356961.png

 

Best,
Rampriya S

View solution in original post

5 REPLIES 5

zhanT
Mega Contributor

Thanks, it's very helpful