Caching that result would require synchronizing it with every change using up memory and performance (at every change) for something that can be computed
So far it has not been worth the effort. If you really need that value very often you could write a small TransactionEventHandler that keeps the count updated for the nodes you're interested in. You would then ask this handler for the Rel-Count of a node, which would either compute it (and add/register it to its cache) or just return it from the cache. Michael Am 20.07.2011 um 21:50 schrieb cyuczi eekc: > I guess I was hoping it(size/count) was cached in the database or the > underlaying database would provide this somehow, ie. in berkeleydb (java > edition) there's a cursor.count() I could use (though I don't know how they > did it implementation-wise) > > Thanks! I needed to know that. > > On Wed, Jul 20, 2011 at 8:37 PM, Jim Webber <[email protected]> wrote: > >> Hi, >> >> Responses from calling the Neo4j APIs are typically lazy, for performance >> reasons. So there's no way of eagerly counting the number of relationships >> unless you force eager evaluation as you've suggested below. >> >> Jim >> >> On 20 Jul 2011, at 11:13, cyuczi eekc wrote: >> >>> Is there a way to get the number of relationships without having to >> iterate >>> through (and count++) them? >>> ie. rels=firstNode.getRelationships(); >>> rels.size(); //doesn't actually exist >>> _______________________________________________ >>> Neo4j mailing list >>> [email protected] >>> https://lists.neo4j.org/mailman/listinfo/user >> >> _______________________________________________ >> Neo4j mailing list >> [email protected] >> https://lists.neo4j.org/mailman/listinfo/user >> > _______________________________________________ > Neo4j mailing list > [email protected] > https://lists.neo4j.org/mailman/listinfo/user _______________________________________________ Neo4j mailing list [email protected] https://lists.neo4j.org/mailman/listinfo/user

