Concerning: exists(doc($URI)): 80 us (microseconds) doc-available($URI): 200 us
Would the first option (using doc($URI)) put a read lock on the file? And the second not? Just wondering about side effects of the test. On Thu, Apr 25, 2013 at 6:21 AM, Ryan Dew <[email protected]> wrote: > Interesting. The results could be affected by having the document already > in the caches. You might want to include non-existing documents in your > test. You could also try: > > xdmp:exists(cts:search(fn:collection(), cts:document-query($URI))) > On Apr 24, 2013 10:34 PM, "Tim Finney" <[email protected]> wrote: > >> Hi Ryan, >> >> Here are the profile times I get using qconsole to test for existence of >> a (known to exist) doc at $URI: >> >> exists(doc($URI)): 80 us (microseconds) >> doc-available($URI): 200 us >> cts:uri-match($URI): 42000 us >> >> Best, >> >> Tim Finney >> >> On 04/25/2013 12:22 PM, Tim wrote: >> >> What about searching the uri lexicon?**** >> >> ** ** >> >> *From:* [email protected] [ >> mailto:[email protected]<[email protected]>] >> *On Behalf Of *Ryan Dew >> *Sent:* Thursday, April 25, 2013 12:04 AM >> *To:* MarkLogic Developer Discussion >> *Subject:* Re: [MarkLogic Dev General] How to test whether doc exists**** >> >> ** ** >> >> fn:doc-available is pretty fast.**** >> >> On Apr 24, 2013 9:36 PM, "Tim Finney" <[email protected]> wrote:**** >> >> Hi All, >> >> What is the fastest way to test for existence of a document in the >> database? >> >> This is the fastest way I know: >> >> let $URI := "/path/to/doc.xml" >> return exists(doc($URI)) >> >> It takes about 75 us (microseconds) to return an answer according to the >> profile tab of qconsole. >> >> Best, >> >> Tim Finney >> _______________________________________________ >> General mailing list >> [email protected] >> http://developer.marklogic.com/mailman/listinfo/general**** >> >> >> _______________________________________________ >> General mailing >> [email protected]http://developer.marklogic.com/mailman/listinfo/general >> >> >> >> _______________________________________________ >> General mailing list >> [email protected] >> http://developer.marklogic.com/mailman/listinfo/general >> >> > _______________________________________________ > General mailing list > [email protected] > http://developer.marklogic.com/mailman/listinfo/general > >
_______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
