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.

Time difference between deleteRecord vs deleteMultiple

Suggy
Giga Sage

I need to delete around 100k records.

 

I tested with deletion of 2000 records using both methods, I did not find much difference in the time it took using both methods (deleteRecord vs deleteMultiple) for deleting same data (hardly a difference of 10s)

 

But I read in other community posts that 'deleteMultiple' will be quicker.

 

Question - Is is like only for LARGER datasets only deleteMultiple will make a difference and not smaller datasets?

If yes, larger datasets means how large?

 

5 REPLIES 5

Bert_c1
Kilo Patron

That will depend on the table, and number of reference fields. Deleting a large amount of records should be done in chucks.  Add logic for that in your script, run it as a scheduled job maybe. But 100K may not take that long if you use Scripts - Background.

@Bert_c1 When I deleted 'SAME SET OF RECORDS' using both methods (2k records), I hardly found a difference of 10s. ust a matter of 10s, is that quicker 🙂

Is that expected? J

Satishkumar B
Giga Sage
Giga Sage

hi @Suggy 

For more efficient bulk deletions, use `deleteMultiple()` to enhance performance and reduce processing time. To gauge the benefits, conduct tests with a larger dataset (e.g., 5,000 to 10,000 records) before executing the final deletion.

 

Please mark my response as helpful or accept it as a solution if it meets your needs.

Question - Is is like only for LARGER datasets only deleteMultiple will make a difference and not smaller datasets?

If yes, larger datasets means how large?