Hi Manuel,

> dimcon____geheugen-van-nederland        QUERY(3)        for $i in 
> /record[@version =
> 0] order by $i/system/index return $i   OK      0.06 ms

as you have already seen, all results are first cached by the client
if they are requested via the iterative query protocol. In earlier
versions of BaseX, results were returned in a purely iterative manner
-- which was more convenient and flexible from a user's point of view,
but led to numerous deadlocks if reading and writing queries were
mixed.

If you only need parts of the requested results, I would recommend to
limit the number of results via XQuery, e.g. as follows:

  ( for $i in /record[@version = > 0]
  order by $i/system/index
  return $i) [position() = 1 to 1000]

Next, it is important to note that the "order by" clause can get very
expensive, as all results have to be cached anyway before they can be
returned. Our top-k functions will probably give you better results if
it's possible in your use case to limit the number of results [1].

A popular alternative to client-side caching (well, you mentioned that
already) is to overwrite the code of the query client, and directly
process the returned results. Note, however, that you need to loop
through all results, even if you only need parts of the results.

Hope this helps,
Christian

[1] http://docs.basex.org/wiki/Higher-Order_Functions_Module#hof:top-k-by
_______________________________________________
BaseX-Talk mailing list
[email protected]
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk

Reply via email to