Hello,
thanks to the all the answers I received in the thread "Optimization of a slow query with `//`" I can now make most of my queries much faster. However, while rewriting these queries I noticed that almost all the queries in my application could be rewritten in the form
/tei:TEI/tei:text/tei:body//tei:ELEM[PREDICATE]
and I wondered if it was possible to tell BaseX (or to have it understand by itself) that it can cache and reuse the results of
/tei:TEI/tei:text/tei:body//tei:ELEM
and only apply PREDICATE on the saved set of results.
Is something like this available in BaseX?
I suppose this could have a big impact on my queries, because the base query executes in about 250 ms and most of the other unoptimized queries in about 280 ms. This means that with the case in place they should complete in 30 ms (or 50 ms in more realistic terms).
I tried sending via HTTP a dummy request for `/tei:TEI/tei:text/tei:body//tei:ELEM` together with a `<option name='cachequery' value='true'/>` to warm up the cache. Unfortunately all I got back was a "Unknown option 'CACHEQUERY'" error (with BaseX 8.2.1). Any idea why?
Regards,
-- Gioele Barabucci gioele@svario.it
I wondered if it was possible to tell BaseX (or to have it understand by itself) that it can cache and reuse the results of
/tei:TEI/tei:text/tei:body//tei:ELEM
and only apply PREDICATE on the saved set of results.
Is something like this available in BaseX?
No, I'm afraid (and I'm not sure how to easily realize this for arbitrary requests). If performance is critical, and if you believe nothing more can be done, you could still think about creating additional index structures for your data and access these instead (just as Fabrice motivated in his reply).
Unfortunately all I got back was a "Unknown option 'CACHEQUERY'" error (with BaseX 8.2.1). Any idea why?
I now know why: Because it has recently been removed. All it did was to cache results before returning them to the client instead of streaming them. This option was only used for our GUI, but another solution has now been found there.
I have updated our documentation. Thanks for the hint, Christian
Did not try this out (just a thought), but if you are using the Java API, you could hold a reference to /tei:TEI/tei:text/tei:body//tei:ELEM and execute the predicates ".[PREDICATE]" using the reference as context node.
2015-06-15 16:13 GMT+02:00 Christian Grün christian.gruen@gmail.com:
I wondered if it was possible to tell BaseX (or to have it understand by itself) that it can cache and reuse the results of
/tei:TEI/tei:text/tei:body//tei:ELEM
and only apply PREDICATE on the saved set of results.
Is something like this available in BaseX?
No, I'm afraid (and I'm not sure how to easily realize this for arbitrary requests). If performance is critical, and if you believe nothing more can be done, you could still think about creating additional index structures for your data and access these instead (just as Fabrice motivated in his reply).
Unfortunately all I got back was a "Unknown option 'CACHEQUERY'" error (with BaseX 8.2.1).
Any
idea why?
I now know why: Because it has recently been removed. All it did was to cache results before returning them to the client instead of streaming them. This option was only used for our GUI, but another solution has now been found there.
I have updated our documentation. Thanks for the hint, Christian
basex-talk@mailman.uni-konstanz.de