Without queries and sample docs I can only give fairly generic advice. Profile the slow query. See where it is spending time, and concentrate on optimizing that.
Speculating a bit, it sounds like step #2 can select tens of thousands of documents for potential update. That means you're read-locking all those documents, and upgrading some of the read locks to write locks. It's generally too time-consuming to lock more than about 500-5000 documents at a time. So I would break step #2 into a search phase and new step #3 with single-document updates. I would probably use cts:uris instead of search in step #2. In step #3 I would use a Java loop to pass each matching document URI individually to a single-document update. However at that point you've reinvented a lot of https://github.com/marklogic/corb - so why not just use corb instead? Or at least study its design. -- Mike On 23 Dec 2013, at 02:44 , ShaikUmmerFaruk D <[email protected]> wrote: > > Hi, > > Problem : Mark logic takes too long for insertion of a node inside a xml. > > Details : > > The implementation of the above problem required pre and post > process which can be found below. > > 1. Get the list of documents that has a particular node. > > 2. List of documents is got in Java and iterate the list and send each > document to a XQuery function which does the following. > > a. search:search is used to search for documents that has a particular > node value. > b. Looping the documents returned by search:search and check if a node > “test” exists in the document. > c. If “test” is not present in the document then inserting the node > “test” in it. > > Results: > > 1. 72000 documents are returned > > 2. While searching for node “test” in these 72000, for about 2000 > documents the processing speed to check for node “test” takes about 1 second > per document. After which the speed drops to 20 seconds per document. > > Please suggest solution for this problem. > > Regards, > Shaik Ummer Faruk D. > > **************** CAUTION - Disclaimer ***************** > This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely > for the use of the addressee(s). If you are not the intended recipient, please > notify the sender by e-mail and delete the original message. Further, you are > not > to copy, disclose, or distribute this e-mail or its contents to any other > person and > any such actions are unlawful. This e-mail may contain viruses. Infosys has > taken > every reasonable precaution to minimize this risk, but is not liable for any > damage > you may sustain as a result of any virus in this e-mail. You should carry out > your > own virus checks before opening the e-mail or attachment. Infosys reserves the > right to monitor and review the content of all messages sent to or from this > e-mail > address. Messages sent to or from this e-mail address may be stored on the > Infosys e-mail system. > ***INFOSYS******** End of Disclaimer ********INFOSYS*** > > _______________________________________________ > General mailing list > [email protected] > http://developer.marklogic.com/mailman/listinfo/general _______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
