[xquery-talk] Running XQuery using doc() and collection()

Wolfgang wolfgang at exist-db.org
Thu Jan 24 21:41:08 PST 2008


> I have set these files up on another server so now all the files have http://chausie.slis.indiana.edu:8080/exist/rest//db/foo/ in front of it all the the files within the doc() . The problem is that this is running at the speed of 10 seconds for 800KB of data parsing.

Is there a special reason for storing the documents on one machine while 
executing the query on another one? While this is basically possible, it 
is not efficient if you want to benefit from indexes etc. The data has 
to be retrieved and parsed before it can be queried. Instead, the query 
should run on the eXist server which contains the documents. Otherwise 
you don't need to store the documents into eXist at all.

> I have now switched the first statement from
> 
> let $addresses := (doc("1.xml") | doc("3.xml") |doc("4.xml") | doc("2.xml"))//bibl/p/address
> 
> to
> 
> let $addresses := (fn:collection("xmldb:exist://chausie.slis.indiana.edu:8080//db/resuml")//bibl/p/address)

I'm not sure if eXist supports this URI scheme within collection(). 
Again, I would recommend to run the query on the server. In this case, 
you don't need to specify a full URI since all relative URIs will be 
interpreted as being relative to the db. Thus

fn:collection("/db/resuml")//bibl/p/address

should be ok.

Wolfgang


More information about the talk mailing list