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

Reply via email to