It would be interesting if you could perform the tests with Tamino 4.2.1.8 on Windows 2K3.
To get an explanation you can put {?explain?} in front of your query. This will show you the query execution plan that is executed by the Tamino XQuery processor to retrieve the query result. In order to understand the explain output it might be helpful to read the paper:
Thank for your article, I’ve realized a big difference in fundamental between Tamino XQuery and relational SQL (where I came from).
Actually, my XQuery was like this:
let $b:=count(for $a in input()/doc return $a/element1)
return $b
‘element1’ has both standard and text index defined.
I was assuming by returning ‘$a/element1’, this would enhance the optimizer since it would work similar to a ‘covering’ index in SQL, where the data is already covered or made available by the index, it doesn’t cost any extra to retrieve it.
Little did I know, index in Tamino only provides access to the documents, not for retrieving data. I guess there are no such thing as covering index due to the nature of hierchical data.
Now the XQuery count works fine:
let $b:=count(for $a in input()/doc return $a)
return $b