I think one advantage xdmp:exists has is that you can put any searchable XPath xpression in there. So if you wanted it to return true only if a document had a particular element, for example, then you can do something like this:
xdmp:exists(fn:doc("/my/uri.xml")/foo) So it depends if all you want to do is to see if the document exists or if you want to do more. -Danny -----Original Message----- From: general-boun...@developer.marklogic.com [mailto:general-boun...@developer.marklogic.com] On Behalf Of Michael Blakeley Sent: Thursday, March 01, 2012 1:31 PM To: MarkLogic Developer Discussion Subject: Re: [MarkLogic Dev General] Is fn:doc-available() high performance, or should we use something else like cts:uri-match()? It looks to me like doc-available($uri) is equivalent to xdmp:exists(doc($uri)) now. Either expression results in a simple list-cache lookup, with no tree fetches and no reliable difference in elapsed-time. If you use a uri lexicon, probably something like exists(cts:uris($uri, 'limit=1')) will be faster than cts:uri-match($uri). But I think there might be cases where doc-available is cached and the lexicon lookup is not, so the lexicon lookup may not always be faster than doc-available. -- Mike On 1 Mar 2012, at 13:25 , Danny Sokolsky wrote: > xdmp:exists(fn:doc("/my/uri.xml")) > > will be fast. > > The uri lexicon functions are also a good choice. > > -Danny > > > > From: general-boun...@developer.marklogic.com > [mailto:general-boun...@developer.marklogic.com] On Behalf OfDavid Swearingen > Sent: Thursday, March 01, 2012 1:15 PM > To: general@developer.marklogic.com > Subject: [MarkLogic Dev General] Is fn:doc-available() high performance, or > should we use something else like cts:uri-match()? > > We have a system with a million or so records. When attempting to discern if > a doc with a given uri is in the system, what's the fastest method? Thanks. > > > _______________________________________________ > General mailing list > General@developer.marklogic.com > http://developer.marklogic.com/mailman/listinfo/general _______________________________________________ General mailing list General@developer.marklogic.com http://developer.marklogic.com/mailman/listinfo/general _______________________________________________ General mailing list General@developer.marklogic.com http://developer.marklogic.com/mailman/listinfo/general