XQuery and X-Query

Hi, my XML document is:

Attributes “Id” and “ref” are standard indexed. I have 30000 “Segment” documents with Ref=2 into database.
if i use:


Tamino responses very quickly (less than 1 second), but if I use:

?_xquery=let $b:=input()/Segment[@Ref=2] return count($b)

it responses very slow (about 25 seconds for 30000 segments), and this time increases if I insert more documents.
X-Query has much better performance than XQuery, why?
I’m working with API for .Net so that I must use XQuery.
Can I use other XQuery query ?

I can’t explain the X-Query/XQuery performance difference. I would expect at the very least that X-Query was a “simpler” implementation compared to the far more complex XQuery.

It looks like you are trying to optimise an XQuery. The W3C XQuery forum is probably more appropriate.

I’ve found this


in Native XML Store & X-Query forum