Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Delete Multiple records

Ballela Siva Te
Tera Contributor

Hi All,

 

We want to delete multiple records in Software Installation table approx 8.8 Million records

 

The purpose of this activity is to clean up the data and load it fresh, can You recommend a best solution with out any performance issues

 

Instance : Test environment

 

Regards,

B Siva Teja

3 REPLIES 3

Sarthak Kashyap
Mega Sage

Hi @Ballela Siva Te ,

 

Please check below links

https://www.servicenow.com/community/ham-forum/please-help-me-in-deleting-millions-of-records-from-t...

https://www.servicenow.com/community/service-management-forum/about-deleting-a-large-number-of-recor...

 

Also check below script you can write a fix script or schedule job which runs daily and write below script

var gr = new GlideRecord('table_name');
gr.addQuery('<your_query>');
gr.setLimit(50000);
gr.setWorkflow(false);
gr.query();
gr.deleteMultiple();

 

Please mark my answer correct and helpful if this works for you

Thanks and Regards,

Sarthak

Nikhil Bajaj9
Tera Sage
Tera Sage

Hi @Ballela Siva Te ,

 

Delete records with background script and in chunk of 10K or 5 K.

 

Please appreciate my efforts, help and support extended to you by clicking on – “Accept as Solution”; button under my answer. It will motivate me to help others as well.
Regards,
Nikhil Bajaj

ServiceNow Rising Star-2025

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @Ballela Siva Te 

To do this, you need to process the data in chunks — 8.8 million records is a huge volume and can impact performance. Perform the operation after office hours or during non-peak times, and handle it in batches of 10–15k records at a time.

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************