Firstly, did you know that you can set the size of the java heap space? For example

java -Xmx1g net.sf.saxon.Query ...

sets it to 1Gb, which should be enough to process source documents of around 200Mb.

You haven't said how big your documents are. When they get beyond this kind of size, there are a couple of features in Saxon-EE that you might find useful:

(a) document projection:

http://www.saxonica.com/documentation/sourcedocs/projection.xml

This analyzes the query before building the source document tree, and then while building the tree, discards all parts of the document that aren't needed to answer the query. The effectiveness obviously depends on your query.

(b) streamed processing

http://www.saxonica.com/documentation/sourcedocs/streaming.xml

This avoids building the source tree in memory entirely, provided that you restrict yourself to a subset of the language that can be processed in streaming mode. Streaming in Saxon is more advanced for XSLT than for XQuery, though some features are available in XQuery too.

Generally the size of the query result is irrelevant: the result will usually be streamed directly to the serializer, unless you explicitly ask for the result in the form of an in-memory tree. It's usually the size of the source document that matters. Occasionally, for complex queries, intermediate results can be the critical factor.

Michael Kay
Saxonica

On 14/04/2012 04:09, Jim brown wrote:
Hello, I get a question. Sometimes when I use saxon to query a XML file, the result is so big that a 'java heap space' is encountered. If I can set the size of result and only the size of data will be queried, the error will be avoided and the query will be more efficient. So is there a setting or parameter I can set to solve my problem, or some other ways I can go?  Thank you.
PS: my English is not very well, I hope I didn't make a mistake. I'm trying.


------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2


_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
saxon-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/saxon-help