You can use a JCR-SQL2 query similar to the following to count the nodes under a given path:
SELECT COUNT(*) AS total FROM [nt:base] AS node
WHERE ISDESCENDANTNODE(node, '/your/path')
Replace '/your/path' with the actual path you want to count nodes for. This query uses the COUNT(*) function to return the total number of nodes under the specified path.
When the number of nodes exceeds 100,000, the query, instead of completing, it throws a RuntimeNodeTraversalException to prevent excessive resource consumption and potential performance degradation.
By conducting this test, you can confirm that the issue is specifically related to the number of nodes under the root node. I recommend performing this in a non-live environment due to potential negative impacts.