I think the problem relates to whether the XQuery is optimised or not.
There is a section in the documentation called “Performance Guide”, “Efficient Queries: XQuery”, “Value Range Predicates”. This tells you that for optimization to be effective “Node expression must be a variable (and) variables must be equal for both comparisons.”
In your case, the node expression is “id>=0 and id<=3” so “id” is not a variable. If you look at the analysis of your original XQuery in the Interactive Interface, it probably looks like two index lookups inside a logical “and” function. This will be slow if the index lookups return many results to be ANDed together.
Now try to change your XQuery to use variables so that optimization happens correctly:
for $i in input()/Locali
let $x := $i/id
where $x >=0 and $x <=3
return $i
If you analyse the new XQuery you should see a single Index Scan containing a ValueRangeIndexPredicate. This should be faster.
HTH
#API-Management#Tamino#webMethods