The current implementation iterates over all the children: it may take a long time and in some extreme cases, it can provoke OOM (case with a folder with 70k children).
Even if it does not make a lot of sense to use an ordered folder with 70k children, we need to improve the current implementation to scale in similar cases.
Both VCS and DBS implementation are affected by this problem as they both get all children :
- VCS : https://github.com/nuxeo/nuxeo/blob/release-10.10/nuxeo-core/nuxeo-core-storage-sql/nuxeo-core-storage-sql/src/main/java/org/nuxeo/ecm/core/storage/sql/PersistenceContext.java#L1329
- DBS : https://github.com/nuxeo/nuxeo/blob/release-10.10/nuxeo-core/nuxeo-core-storage-dbs/src/main/java/org/nuxeo/ecm/core/storage/dbs/DBSSession.java#L475