Performance issue: It Is Taking Too Long To Delete Empty GroupsIssue While trying to delete AD groups, it is taking so much time. It should not take this long to delete empty groups. Example: Approximately It took around 1 hour to delete 100 records. Steps to reproduce:1. Navigate to User Administration > Groups2. Selecting the AD groups 3. Select delete option in the Actions on selected rows4. it is taking long time to delete those records ReleaseOrlandoCauseDeleting sys_user_group records is triggering queries to the ECC queue which is slowing the transaction.The above is caused by a known issue, PRB1395462, which leads to massive queries across many tables.ResolutionFIX: PRB1395462 is fixed in Paris, so the permanent fix is to upgrade to Paris. WORKAROUND: If unable to upgrade right now, the suggestion is to use a script to delete the groups0) Log into https://YOURINSTANCENAME.service-now.com/1) Go to /sys_user_group_list.do and use the filter to show the exact groups that you want to delete. For example: Name is one of , then enter the list of groups you want to delete 2) Right click at the end of the filter and choose the "Copy query" option. You will use this encoded query in step 42) Go to the sys.scripts.do module where you can run scripts:https://YOURINSTANCENAME.service-now.com/sys.scripts.do3) Make sure that you uncheck the checkbox that says "cancel after 4 hours"; in case this transaction takes more than 4 hours, you want to allow it to keep running.4) In the following code, Locate and change this line -- delGR.addEncodedQuery('nameINmy_group1,my_group2,my_group3'); -- to ensure you enter the names of the groups you want to delete : //you can adjust the number of batches as needed based on how many records you are deleting//Delete the records in 200 batches of 10 recordsvar max = 200;for (i = 0; i < max; i++) {gs.log('Batch ' + i + ' Started', 'BATCHDELETE');var timestamp1 = new Date();//this is the number of records to be processed at one time - should be left at 10var limit = 10;//change this to the table you want to delete from; in you case, you want to delete from sys_user_groupvar delGR = new GlideRecord('sys_user_group');//include the criteria for the records to be deleted; In this example we want to delete these groups: my_group1, my_group2, my_group3delGR.addEncodedQuery('nameINmy_group1,my_group2,my_group3');delGR.setLimit(limit);//this should always be false - it will prevent business rules and workflows from triggeringdelGR.setWorkflow(false);delGR.query();gs.log('ROWCOUNT = ' + delGR.getRowCount(), 'BATCHDELETE’);//This will delete each record in delGR - you can comment out these 2 lines to test without deletingwhile (delGR.next()) {delGR.deleteRecord();}//Prints the time each batch took to complete.var timestamp2 = new Date();var timestampdiff = (timestamp2 - timestamp1) / 1000;gs.log('Batch ' + i + ' took ' + timestampdiff, 'BATCHDELETE');} 5) Once you have modified the above code to ensure you are deleting the groups you want, paste the modified code into the sys.scripts.do 's window6) Click on "RUN SCRIPT" button7) Monitor the progress of the script using this URL:https://YOURINSTANCENAME.service-now.com/syslog_list.do?sysparm_query=source%3DBATCHDELETERelated Links ##########################grep_txn 230162 localhost_log.2020-11-07.txt2020-11-07 03:18:08 (928) http-44 New transaction E11D9B061B54A410A782DD79B04BCB77 #230162 /xmlhttp.do2020-11-07 03:18:08 (934) Default-thread-65 E11D9B061B54A410A782DD79B04BCB77 txid=0673ab0a1b94 #230162 /xmlhttp.do Parameters -------------------------sysparm_scope=globalsysparm_processor=DeleteRecordAjaxsysparm_want_session_messages=truesysparm_obj_list=7053a0e9db7d84508a80d498f4961980,7053a0e9db7d84508a80d498f496199c,f053a0e9db7d84508a80d498f496199f,7453a0e9db7d84508a80d498f49619a2,f453a0e9db7d84508a80d498f49619a5,7453.......sysparm_name=proceedWithDeleteFromListsysparm_table_name=sys_user_group2020-11-07 03:18:08 (934) Default-thread-65 E11D9B061B54A410A782DD79B04BCB77 txid=0673ab0a1b94 *** Start #230162 /xmlhttp.do, user: sekard2020-11-07 03:18:09 (229) Default-thread-65 E11D9B061B54A410A782DD79B04BCB77 txid=0673ab0a1b94 Time: 0:00:00.105 id: bmsnprod_1[glide.1] (connpid=171593) for: (SELECT ecc_queue00000.`sys_id`, 'ecc_queue0000' AS `sys_table_name` FROM ecc_queue0000 ecc_queue00000 WHERE ecc_queue00000.`agent` = 'mid.server.ABR-DISC-NPROD-02' AND ecc_queue00000.`topic` = 'SystemCommand' AND ecc_queue00000.`state` = 'ready' AND ecc_queue00000.`source` = 'load_properties' AND ecc_queue00000.`priority` = 0 AND ecc_queue00000.`queue` = 'output') UNION ALL (SELECT ecc_queue00010.`sys_id`, 'ecc_queue0001' AS `sys_table_name` FROM ecc_queue0001 ecc_queue00010 WHERE ecc_queue00010.`agent` = 'mid.server.ABR-DISC-NPROD-02' AND ecc_queue00010.`topic` = 'SystemCommand' AND ecc_queue00010.`state` = 'ready' AND ecc_queue00010.`source` = 'load_properties' AND ecc_queue00010.`priority` = 0 AND ecc_queue00010.`queue` = 'output') UNION ALL (SELECT ecc_queue00020.`sys_id`, 'ecc_queue0002' AS `sys_table_name` FROM ecc_queue0002 ecc_queue00020 WHERE ecc_queue00020.`agent` = 'mid.server.ABR-DISC-NPROD-02' AND ecc_queue00020.`topic` = 'SystemCommand' AND ecc_queue00020.`state` = 'ready' AND ecc_queue00020.`source` = 'load_properties' AND ecc_queue00020.`priority` = 0 AND ecc_queue00020.`queue` = 'output') UNION ALL (SELECT ecc_queue00030.`sys_id`, 'ecc_queue0003' AS `sys_table_name` FROM ecc_queue0003 ecc_queue00030 WHERE ecc_queue00030.`agent` = 'mid.server.ABR-DISC-NPROD-02' AND ecc_queue00030.`topic` = 'SystemCommand' AND ecc_queue00030.`state` = 'ready' AND ecc_queue00030.`source` = 'load_properties' AND ecc_queue00030.`priority` = 0 AND ecc_queue00030.`queue` = 'output') UNION ALL (SELECT ecc_queue00040.`sys_id`, 'ecc_queue0004' AS `sys_table_name` FROM ecc_queue0004 ecc_queue00040 WHERE ecc_queue00040.`agent` = 'mid.server.ABR-DISC-NPROD-02' AND ecc_queue00040.`topic` = 'SystemCommand' AND ecc_queue00040.`state` = 'ready' AND ecc_queue00040.`source` = 'load_properties' AND ecc_queue00040.`priority` = 0 AND ecc_queue00040.`queue` = 'output') UNION ALL (SELECT ecc_queue00050.`sys_id`, 'ecc_queue0005' AS `sys_table_name` FROM ecc_queue0005 ecc_queue00050 WHERE ecc_queue00050.`agent` = 'mid.server.ABR-DISC-NPROD-02' AND ecc_queue00050.`topic` = 'SystemCommand' AND ecc_queue00050.`state` = 'ready' AND ecc_queue00050.`source` = 'load_properties' AND ecc_queue00050.`priority` = 0 AND ecc_queue00050.`queue` = 'output') /* bmsnprod023, gs:E11D9B061B54A410A782DD79B04BCB77, tx:0673ab0a1b94a410a782dd79b04bcbe9 *##########################