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

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

  • February 20, 2025
  • 4 replies
  • 697 views

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

4 replies

giuseppebaglio
New Participant
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
DPrakashRaj
New Participant
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

ayush-anand
New Participant
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