Too many same-level JCR entries

In JCR (Java Content Repository) and the Jackrabbit implementation of JCR, there’s no hard limit on the number of items that can exist at one level. However, the performance of the repository may degrade as the number of child items at a particular level increases.

The optimal number of child nodes per level depends on many factors, including the specific use case and the performance characteristics of the underlying storage system.

In general, for smooth performance, it’s recommended to limit the number of child nodes to a few hundred or less at each level.

Click to see a Groovy script to split flat structures into folders
folderSize = 100
workspace = "tours"
nodeType = "mgnl:content"
rootPath = "/magnolia-travels/"
query = "select * from [" + nodeType + "] WHERE ISDESCENDANTNODE('" + rootPath + "')"
session = MgnlContext.getJCRSession(workspace);
manager = session.getWorkspace().getQueryManager();
nodes = manager.createQuery(query, "JCR-SQL2").execute().nodes;
folderName = 0
nodesInFolder = 0
while (nodes.hasNext()) {
    folderPath = rootPath + folderName
    NodeUtil.createPath(session.rootNode, folderPath, "mgnl:folder");
    node =
    newPath = rootPath + folderName + "/" +;
    if (node.path != newPath) { //repeatable script
        session.move(node.path, newPath);
    if (nodesInFolder++ > folderSize) {
        nodesInFolder = 0
  • You can still retrieve the tree structure as a list through, for example, search templating functions.

  • Using a balanced tree structure, you can mitigate performance issues when publishing hundreds of items at once. See the itemsPerRequest property of the publish command.


DX Core



This widget lets you know where you are on the docs site.

You are currently perusing through the DX Core docs.

Main doc sections

DX Core Headless PaaS Legacy Cloud Incubator modules
6.3 beta

Magnolia 6.3 beta

Magnolia 6.3 is in beta. We are updating docs based on development and feedback. Consider the 6.3 docs currently in a state of progress and not final.

We are working on some 6.3-beta known issues during this phase.