By calling /text() on the node with the range index you are probably short circuiting any potential performance optimization by forcing the evaluation of text() on every node in that sequence before sorting. Remove that function call.
You can double check to see if the index optimization is happening by adding xdmp:query-trace(true()) to the beginning of your query. If the range index is used, in the log file you will see "Order by clause contributed 1 range ordering constraint for ..." -Will > On Jun 24, 2015, at 9:12 AM, Asit Nautiyal <[email protected]> wrote: > > Hi Kiruthika, > > One more thing to add here, while creating range index for element "date" > for properties document make sure namespace uri value should be > "http://marklogic.com/xdmp/property". > > And then use, order by > (xdmp:document-get-properties($uri,xs:QName("prop:date"))/text()) in code and > declare namespace prop = "http://marklogic.com/xdmp/property"; in xquery > file. > > > Regards, > Asit Nautiyal > From: [email protected] > To: [email protected] > Date: Wed, 24 Jun 2015 13:57:05 +0000 > Subject: Re: [MarkLogic Dev General] Range-index on document Property > > Hi Kiruthika, > > if you create range index on element used in "orderby" will definitely boost > the performance whether element is in xml document or in property. > > > Regards, > Asit Nautiyal > > Date: Wed, 24 Jun 2015 09:27:21 -0400 > From: [email protected] > To: [email protected] > Subject: [MarkLogic Dev General] Range-index on document Property > > Hi, > Will adding a range index on a property element, help in increasing the > performance when used in "orderby" for sorting.We are aware that adding range > index on elements increase performance in orderby for sorting. But since this > is a property we are not sure. > > For example, > > order by (xdmp:document-get-properties($uri,xs:QName("date"))/text()) > > Note: Here 'date' is a ML property. So will adding a range index on "date" > element increase the performance ? > > Regards, > Kiruthika > > _______________________________________________ General mailing list > [email protected] Manage your subscription at: > http://developer.marklogic.com/mailman/listinfo/general > > _______________________________________________ General mailing list > [email protected] Manage your subscription at: > http://developer.marklogic.com/mailman/listinfo/general > _______________________________________________ > General mailing list > [email protected] > Manage your subscription at: > http://developer.marklogic.com/mailman/listinfo/general _______________________________________________ General mailing list [email protected] Manage your subscription at: http://developer.marklogic.com/mailman/listinfo/general
