I am using below two queries(Optic and CTS)
to get the values for path-range index /tXML/Item/PutawayCategory
.
Query 1: - It took approx. 4 milliseconds
to execute and return 17 distinct values. I tried executing this same query multiple times.
xquery version "1.0-ml";
import module namespace op="http://marklogic.com/optic" at "/MarkLogic/optic.xqy";
op:from-lexicons(map:entry("PutawayCategory", cts:path-reference("/tXML/Item/PutawayCategory")))
=> op:where-distinct()
=> op:result()
Query 2: - It took approx. 0.30 milliseconds
to get the same result as Query 1
xquery version "1.0-ml";
cts:values(cts:path-reference("/tXML/Item/PutawayCategory"))
I am not getting why Optic Query
is taking more time to execute than cts
query.
Please help me to understand this.