Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I query MarkLogic to determine cost of re-indexing?

Tags:

marklogic

I have a multi-terabyte Production database (MarkLogic 9.0-8, RedHat) that I need to add 2 new element range indexes to. Before I can execute the change, I need to get an estimate of the number of documents that will be impacted by the re-index to ensure my maintenance window is sufficient to avoid performance impacts. Will the following code provide me with what I am needing?

xquery version "1.0-ml";

xdmp:estimate(cts:search(fn:doc(), cts:word-query("someTimestamp")));
xdmp:estimate(cts:search(fn:doc(), cts:word-query("someString")));
like image 757
dan Avatar asked Jan 26 '26 08:01

dan


1 Answers

Instead of a word-query I'd rather count the fragments containing the elements of your two new element range indexes using a element-query.

xdmp:estimate(
  cts:search(fn:doc(), 
    cts:element-query(xs:QName("your-index-element"), (cts:and-query(())))
  )
) 
like image 120
Wagner Michael Avatar answered Jan 29 '26 13:01

Wagner Michael



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!