[xquery-talk] xquery with large xml file

Michael Kay mhk at mhk.me.uk
Thu Apr 20 10:27:09 PDT 2006


> well, i tried the top down approach code but where can i pass 
> my file name let $j:= doc("book_sample.xml")

Just replace 

local:pathOfNodes('', /*)

with

local:pathOfNodes('', doc("book_sample.xml")/*)

I was using the context node as input primarily because it makes it easier
to measure tree construction as a separate part of the query cost (having
said which, I need to check if the figures I quoted yesterday included tree
construction or not!)

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

> 
> --- Michael Kay <mhk at mhk.me.uk> wrote:
> 
> > > 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/
> > 
> > 
> 
> 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection 
> around http://mail.yahoo.com 
> _______________________________________________
> talk at xquery.com
> http://xquery.com/mailman/listinfo/talk



More information about the talk mailing list