jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gadbury <gadb...@googlemail.com>
Subject Query vs Manual Node Iteration
Date Fri, 19 Mar 2010 08:43:58 GMT

Hi all,

Consider the following structure:


What would be the fastest method to retrieve all account nodes from under
accounts of provider[2] ?  We can assume that for method 1 (the query) that
my:account has the property providerUUID (STRING).

1) an XPath query such as:  //element(*,

2) Getting the (provider[2]) node by UUID, get the accounts node underneath,
call accountsNode.getNodes() and iterate with the NodeIterator, checking
each node is of nodeType my:account and adding the node to a list?

Obviously, the second way I do not need a weak reference to the provider in
nodes of type my:account.

I would assume that the second method is quicker as we're only searching
under a specific node.  The query would search the entire repository
structure, including my:account nodes under other, irrelevant providers so
should be faster...?  I have tried specifying a path constraint in my XPath
queries but I read that is slower due to extra path checks being made.

I would be very interested to learn the advantages and disadvantages of both
approaches.  I also have started to use SQL2 queries (mainly for the join
functionality) but I believe they are slower than XPath.
View this message in context: http://n4.nabble.com/Query-vs-Manual-Node-Iteration-tp1599098p1599098.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.

View raw message