How will long running Delete Job affect an instance?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2023 07:10 AM
Hello all,
I would like to create Delete Job (new Tokyo feature) to remove up to 2-3 million records. It's just to clean up an instance a bit. So it will run only once. It's should run on non production instance. I use condition builder to create my conditions and then click Preview. I can see few hundred thousands or more records which will be deleted.
I don't want to delete whole table and also I would like to delete related records as Delete Job will do.
I assume it will take a lot of time. The question is, if users can work normally during that time with affected tables and if it's possible to tell, how long it will take? E.g. Incident table with 700,000 records + all related stuff will be maybe up to 2,000,000 records.
How is the Delete Job designed? Will it slowly delete all the records which matched the condition at the time of execution start and this process can take few days... or will it "hold" the table and/or whole instance so everyone is completely screwed and nobody can work on affected tables/instance?
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2023 10:37 AM
did you ever find an answer elsewhere?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-01-2023 02:16 AM
no, but it works like this. it's deleting the records in the background slowly. it takes weeks to delete few millions of records. but looks like it's not taking much performance. but it takes too much time. so maybe some advanced script to delete the records is better solution for large amount of data...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-01-2023 02:30 AM
Hi @MartinT,
I too faced same issue in deletion of bulk record, but I tried below script it deleted million of record very quick in non prod environment.
Note : Please try this script at own your risk because it may not work as expected
var md = new GlideMultipleDelete(<table name>);
md.addQueryString(<encoded query>);
md.setAllowCascadeDelete(false); // false is the default value
md.execute();
I will attach the source article to help you to understand the GlideMultipleDelete method below.
Link : https://www.servicenow.com/community/in-other-news/delete-a-massive-amount-of-data-quickly/ba-p/2503...
If my response helps you to resolve the issue close the question by Accepting solution and hit thumb icon. From Correct answers others will get benefited in future.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-01-2023 04:50 AM
thanks for your input but as you can see no one answered me for almost a year so it's too late. we have flying cars already... 😎