Hi Danny,
Performance should be easy to measure. Call the function from within QConsole x number of time and request profile output. Do the same while using xdmp:exists instead of fn:exists. That function works only on (partially) searchable expression, because it doesn’t retrieve the actual content. It won’t create a read-lock either, but I’m not sure why you want one. It won’t prevent duplicate id’s from being generated in concurrent requests.. Kind regards, Geert *Van:* [email protected] [mailto: [email protected]] *Namens *Danny Sinang *Verzonden:* woensdag 29 augustus 2012 19:11 *Aan:* general *Onderwerp:* [MarkLogic Dev General] Performance of fn:exists(fn:doc($uri)) Hi, ML support suggested we do this to generate a unique ID for our documents : declare function choose-uri() as xs:string { let $uri := fn:concat("/document-", xdmp:random(), ".xml") return if (fn:exists(fn:doc($uri))) then choose-uri() else $uri }; My question is, will the call to fn:exists(fn:doc($uri)) be fast, considering that we now have 8 million documents ? The fn:exists(fn:doc($uri)) call is needed to obtain a read lock, which will be upgraded to a write lock when xdmp:document-insert is called. Regards, Danny
_______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
