[xquery-talk] xquery with large xml file

Michael Kay mhk at mhk.me.uk
Wed Apr 19 17:45:17 PDT 2006


> I finally got around to running this against the 100Mb data 
> file with Saxon.
> It produces the same size output (don't know why the 
> expansion factor should be different on the 10Mb file) in 5 
> minutes 45 seconds. 
> 


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.

Michael Kay
http://www.saxonica.com/



More information about the talk mailing list