You can try with path range indexes as well and see which query will give you fast results. Go through page no 29 and 30 of the pdf "inside-marklogic-server-r7.pdf" for more information
Regards, Indy On Thu, Jun 23, 2016 at 1:12 PM, Indrajeet Verma <indrajeet.ve...@gmail.com> wrote: > Hi Hans, > > If you use range queries then you need to create required indexes > manually/via script. As mention in my previous email, create range > indexes on elements "j", "k", "d" and "f" to make it work by going > Configure-->databases>yourdatabase-->Element range indexes. > > Please refer https://docs.marklogic.com/guide/admin/range_index for more > information. > > For your question regarding universal indexing, XPath and cts queries, > please refer > https://developer.marklogic.com/pubs/architecture/inside-marklogic-server-r7.pdf > > > Hope that helps! > > Regards, > Indy > > > On Thu, Jun 23, 2016 at 12:03 PM, Hans Hübner <hans.hueb...@lambdawerk.com > > wrote: > >> Indy, >> >> thank you for your suggestion! If I understand you correctly, the way to >> go about is to build up a query manually rather than asking MarkLogic to >> figure out a query plan based on the XPath provided? >> >> I have tried your solution, but it seems that some manual indexing is >> required to make it work (which is also mentioned in the documentation for >> cts:element-values): >> >> [1.0-ml] XDMP-ELEMRIDXNOTFOUND: cts:element-values(fn:QName("","k"), (), >> (), cts:and-query((cts:document-query("file1.xml"), >> cts:element-value-query(fn:QName("","j"), "123", ("lang=en"), 1)), ())) -- >> No element range index for k http://marklogic.com/collation/ >> >> I will work myself from here, but any suggestion as to how to solve this >> or what other approaches exist would be greatly appreciated! >> >> Thanks, >> Hans >> >> On Thu, Jun 23, 2016 at 7:42 AM, Indrajeet Verma < >> indrajeet.ve...@gmail.com> wrote: >> >>> Hi Hans, >>> >>> You might try below code and see if that helps in improving the >>> performance. You need to create range indexes on elements "j", "k", "d" and >>> "f". >>> >>> BTW what values the elements "k" and "f" does contain? Is it numeric, >>> string or sentences ? If it contains para/sentences then you should think >>> some different way. >>> >>> let $q1 := cts:and-query((cts:document-query("file1.xml"), >>> cts:element-range-query(xs:QName("j"), '=','123'))) >>> for $key in cts:element-values(xs:QName("k"), (), (), $q1) >>> let $q2 := cts:and-query((cts:document-query("file2.xml"), >>> cts:element-range-query(xs:QName("d"), '=',$key))) >>> let $data-from-file-2 := cts:element-values(xs:QName("f"), (), (), $q2) >>> return >>> <pre> >>> $key => $data-from-file-2 >>> </pre> >>> >>> >>> Regards, >>> Indy >>> >>> On Thu, Jun 23, 2016 at 10:23 AM, Hans Hübner < >>> hans.hueb...@lambdawerk.com> wrote: >>> >>>> Hi, >>>> >>>> I have a beginner's question regarding indexing: As far as I >>>> understand, MarkLogic indexes all data according to global indexing rules. >>>> Thus, in general, all accesses to data should be "fast" when the universal >>>> index can be used. >>>> >>>> I am trying to combine data from two XML files into a report, and >>>> throughput is not sufficient. I'm now looking for ways to improve the >>>> performance of my XQuery, either by adding indexes to MarkLogic or by >>>> improving the query so that it runs faster. Here's what I have: >>>> >>>> for $key in doc("file1.xml")/a/b/c/d/e/f/g/h/i[j = 123]/k/text() >>>> let $data-from-file-2 := doc("file2.xml")/a/b[c/d = $key]/e/f/text() >>>> return >>>> <pre> >>>> $key => $data-from-file-2 >>>> </pre> >>>> >>>> Thus, I'm iterating over some subset of the nodes in file1.xml, >>>> selecting data from file2.xml for each of the nodes selected. Both >>>> file1.xml and file2.xml are in a files residing in MarkLogic. They have a >>>> pre-determined format and contain roughly 100,000 elements matching each of >>>> the two paths. >>>> >>>> It seems that the performance of the second of the two XPaths >>>> (doc("file2.xml")/a/b[c/d = $key]/e/f/text()) is most important. Ideally, >>>> I would like this lookup to complete in under a millisecond, but it seems >>>> to need 75ms right now. >>>> >>>> Any help speeding this up would be greatly appreciated! >>>> >>>> Thanks, >>>> Hans >>>> >>>> -- >>>> LambdaWerk GmbH >>>> Oranienburger Straße 87/89 >>>> 10178 Berlin >>>> Phone: +49 30 555 7335 0 >>>> Fax: +49 30 555 7335 99 >>>> >>>> HRB 169991 B Amtsgericht Charlottenburg >>>> USt-ID: DE301399951 >>>> Geschäftsführer: Hans Hübner >>>> >>>> http://lambdawerk.com/ >>>> >>>> >>>> >>>> _______________________________________________ >>>> General mailing list >>>> General@developer.marklogic.com >>>> Manage your subscription at: >>>> http://developer.marklogic.com/mailman/listinfo/general >>>> >>>> >>> >>> _______________________________________________ >>> General mailing list >>> General@developer.marklogic.com >>> Manage your subscription at: >>> http://developer.marklogic.com/mailman/listinfo/general >>> >>> >> >> >> -- >> LambdaWerk GmbH >> Oranienburger Straße 87/89 >> 10178 Berlin >> Phone: +49 30 555 7335 0 >> Fax: +49 30 555 7335 99 >> >> HRB 169991 B Amtsgericht Charlottenburg >> USt-ID: DE301399951 >> Geschäftsführer: Hans Hübner >> >> http://lambdawerk.com/ >> >> >> >> _______________________________________________ >> General mailing list >> General@developer.marklogic.com >> Manage your subscription at: >> http://developer.marklogic.com/mailman/listinfo/general >> >> >
_______________________________________________ General mailing list General@developer.marklogic.com Manage your subscription at: http://developer.marklogic.com/mailman/listinfo/general