[xquery-talk] xquery with large xml file

Florent Georges darkman_spam at yahoo.fr
Thu Apr 20 14:25:15 PDT 2006

Michael Kay wrote:

> The equivalent non-recursive query

> //*/string-join(ancestor-or-self::*/local-name(), '/')

> (actually a pure XPath expression) takes 2 mins 23 seconds.

> I also tried a top-down approach, to reduce the number of
> redundant string concatenations and calls on local-name():

> declare function local:pathOfNodes($parentPath as xs:string, $node as
> node()) as xs:string* {
>     let $this := concat($parentPath, '/', local-name($node)) 
>     return ($this, $node/*/local:pathOfNodes($this, .))
> }; 

> local:pathOfNodes('', /*)

> This took 3m 29s.

  Interesting.  I thought about such a function, while reading this
thread.  I didn't try it, but I thought it was the most efficient.  Is
there some optimization behind the first expression?




Faites de Yahoo! votre page d'accueil sur le web pour retrouver directement vos services préférés : vérifiez vos nouveaux mails, lancez vos recherches et suivez l'actualité en temps réel. 
Rendez-vous sur http://fr.yahoo.com/set

More information about the talk mailing list