[MarkLogic Dev General] Performance of fn:exists(fn:doc($uri))

Danny Sinang d.sinang at gmail.com
Wed Aug 29 10:10:30 PDT 2012


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://developer.marklogic.com/pipermail/general/attachments/20120829/dc5b67bc/attachment.html 


More information about the General mailing list