I want to write a query to traverse through more than 100000(1 lac) nodes | Community
Skip to main content
Level 4
February 20, 2025
Solved

I want to write a query to traverse through more than 100000(1 lac) nodes

  • February 20, 2025
  • 4 replies
  • 702 views

I want to write a query for a groovyscript  to traverse through more than 100000(1 lac) nodes without affecting the performance.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

4 replies

ayush-anand
Level 4
February 20, 2025

Hi @chinmayish ,

 

To efficiently traverse 100,000+ nodes in a Groovy script, ensure relevant properties are indexed. You can create a custom index under in CRXDE. To verify if a query is using an index, check in the Query Debugger tool. 

For best practices, please refer to:

 

Regards,

Ayush

DPrakashRaj
Community Advisor
Community Advisor
February 20, 2025

best solution is to write an optimize query with proper indexing as suggested by others but iof its one time and you can't create a proper indexing you can try increasing the querylimit as well as explained on https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/what-is-maximum-limit-of-hits-of-querybuilder/m-p/460144

giuseppebaglio
Level 10
February 21, 2025

For traversing 100,000+ nodes efficiently in a Groovy script, I recommend:

  1. Use ResourceResolver.getResourceResolver() instead of JCR API when possible
  2. Implement batch processing with chunking (process 1000 nodes at a time)
  3. Use JCR-SQL2 queries with appropriate indexing: Make sure your query has proper Oak index coverage to avoid traversal warnings in logs
  4. Consider async processing with Sling Jobs for very large operations