Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does MarkLogic's "xdmp:collection-delete" work?

I have a scenario where most of the documents i want to delete are in a collection called "expired". I do not want to overload my servers by running a long running process which would iterate over documents and delete them one by one i would rather do them in batch size using document-delete.

So my question is how does xdmp:collection-delete work ?

Does it iterate over documents and delete them ?

or

Does it do something like DROP Table in SQL and its "instantaneous" ?

I want to know what is the background process for xdmp:collection-delete. I wonder if anyone can draw the flow of how this function handles document for deletion as i want to understand the process in more depth than just overview of what it does.

like image 732
Uncle Aaroh Avatar asked Sep 19 '16 10:09

Uncle Aaroh


2 Answers

xdmp:collection-delete() will delete all documents in the collection in a single transaction. While it's not instantaneous, it should be fast, as it just needs to set the deletion timestamp of each document.

like image 99
Dave Cassel Avatar answered Sep 28 '22 14:09

Dave Cassel


You may try to use corb to delete documents one by one. You may increase threads though for parallel processing.

like image 34
Jeet Avatar answered Sep 28 '22 15:09

Jeet