Reputation: 1385
If you are deleting a large number of documents from a Cloudant database, say 2 million, is it best to batch the delete calls, or is there another approach?
Upvotes: 1
Views: 82
Reputation: 1385
Yes, batching the deletes with a _bulk_docs
request is the best way to approach this. Making two million single document delete requests would be impractical.
Deletes are just updates where the new doc revision has the deleted flag set.
The batch size is a bit of a compromise between not too small, to minimise the number of requests; and not so large that it puts too much work on the server. A thousand documents is a reasonable starting point. In this example it would still require 2,000 calls to delete all the documents.
For an example of how to create a batch and issue a bulk delete command see this blog post.
Upvotes: 2