Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Marklogic large delete

Tags:

marklogic

I want to know if anyone has experience of deleting millions of documents in Marklogic? At the moment I used the simple xqueries to fetch the document uri s which need to be deleted and then I use corb to batch the whole operation.

Is there a faster way to delete millions of documents once I have a list of Uris ?

like image 625
Harry Avatar asked Feb 19 '23 10:02

Harry


1 Answers

There are several ways to tackle this. The first question is how you retrieve the document uri's? Best approach for that is using the URI lexicon, and cts:uris or cts:uri-match. Second is how you perform the delete. You could iterate over the found uri's, and call xdmp:document-delete for each, but you might consider skipping all above, and revert to xdmp:collection-delete alltogether. That seems to work very efficient. It does require you to have a unique collection label assigned, and it can be delete entirely..

HTH!

like image 193
grtjn Avatar answered Mar 16 '23 08:03

grtjn