Re: [bdbxml] Paging/controlling result set?
John Snelson <[email protected]> Thu, 08 Sep 2005 13:23:26 +0100
| Newsgroups | gmane.comp.db.dbxml.general |
|---|---|
| Message-ID | <[email protected]> |
Antony Grinyer wrote: > We run queries on a large container that potentially brings back > hundreds of thousands of results from XQueries. We get > BDBXML:allocate():Out of memory errors, which I'm sure is because we're > trying to collect these results all at one in a StringBuffer (not > good!). Is there any way in DB XML to control the result set coming > back? e.g. caching or paging, so the user is not presented with > thousands of results at one time? The best way to acheive a paging effect is to use lazy evaluation. You set this on the XmlQueryContext object: http://www.sleepycat.com/xmldocs/java/com/sleepycat/dbxml/XmlQueryContext.html#setEvaluationType(int) Then when you are iterating through the XmlResults object, make sure that you delete each returned XmlValue object as soon as possible. This will make sure that DB XML uses the least amount of memory possible during it's query. In order to page, you can then return as many results as you need from the XmlResults object, and then store it somewhere until you want to get some more results from it. > Also, does the DB XML caching > environment property increase performance? Our environment is set with: Performance with relation to the Environment is a very large discussion. You will find information regarding it in the documentation: http://www.sleepycat.com/docs/ref/toc.html#env John -- John Snelson, Berkeley DB XML Engineer Sleepycat Software, Inc http://www.sleepycat.com Contracted to Sleepycat through Parthenon Computing Ltd http://blog.parthcomp.com/dbxml ------------------------------------------ To remove yourself from this list, send an email to [email protected]