- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2022 07:32 AM
※Paris version
I want to empty a table with 2 million records.
I tried to delete Records in bulk using "deleteMultiple ()", but the instance freezes and the Records are not deleted.
Is there a limit to the number of items that can be deleted at once?
Also, is there a way to remove it efficiently?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2022 07:47 AM
The below should work for records in excess of 2 million.
deleteMultiple();
Having said that if this is a recurring process there are other options in ServiceNow instance that you can explore - Auto flush for e.g.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2022 07:51 AM
Alternatively,
You can try with deleting with setworkflow false and deleteMultiple() in batches but run them as a fix script in background as there is a cap on user query and it will time out for sure as there are 2 million records, in the background it will continue to run.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2022 07:56 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2022 08:01 AM
Then try running in fix script, in background , in batches. Start small, like 10k and see how much time it takes and accordingly go high like 50k -> 100k till where the system performance doesn't get impacted.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2022 07:47 AM
The below should work for records in excess of 2 million.
deleteMultiple();
Having said that if this is a recurring process there are other options in ServiceNow instance that you can explore - Auto flush for e.g.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2022 11:33 PM
The contents of ".addQuery" that was set before "deleteMultiple ();" seemed to be incomplete and did not seem to work.
When I executed "deleteMultiple ();" without setting any query, all records disappeared.
It is currently empty.
thank you.