AnsweredAssumed Answered

Node loading, caching, and large numbers of nodes

Question asked by marcus on Oct 4, 2006
What kind of pattern is employed around the loading of nodes and if it differs depending on how you do it, with a mind to DB access and performance implications, as I'll be soon refactoring a bunch of code after a very quick POC, which highlighted some instances where > 150 queries were being executed in a single request.

For example, when I do something like


Node n = new Node(nodeRef);

what's accessed from the DB? Is it just the information from the alf_node table, and the properties are then lazy loaded, or will it load all the properties from the alf_node_properties in the same query?

When I call n.getChildAssocs(), are all these objects loaded from the db in one query, or is a separate query launched for each object (assuming it's not in the cache).

I guess I'm concerned that some of my code may be loading several nodes in a collection type method call (eg get children / associations) that might actually be calling many many queries to load those objects.

I'm sure you've got some guidelines you stick to to avoid performance problems, care to share any? :)

Outcomes