Hi, there's a way to optimize this query ? declare namespace s="http://www.schemata.it/lml/1.0"; declare namespace l="http://www.schemata.it/lml/1.0/linker";
let $docs:= for $doc in index-scan-between("document_date",xs:date("2004-01-01"),xs:date("2010-01-01"),"INT")/s:*/s:body let $date:=xs:date($doc/../s:meta/s:info/s:date) --> *performance bottleneck* order by $date descending --> *performance bottleneck* return $doc return count($docs) or it's variation: declare namespace s="http://www.schemata.it/lml/1.0"; declare namespace l="http://www.schemata.it/lml/1.0/linker"; let $docs:= for $doc in document("schemata")/schemata/s:lml/s:massima/s:body let $date:=xs:date($doc/../s:meta/s:info/s:date) where $date>=xs:date("2004-01-01") and $date<=xs:date("2010-01-01") order by $date descending return $doc return count($docs) total time: 1.201 seconds for 41758 items With native indices ? (when you are planning to add it?) Thanks. ------------------------------------------------------------------------------ All of the data generated in your IT infrastructure is seriously valuable. Why? It contains a definitive record of application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-d2d-c2 _______________________________________________ Sedna-discussion mailing list Sedna-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sedna-discussion