Objective

How to analyze slow Oak JCR query performance.

Environment

AEM 6.x / Oak 1.x

Steps

I. Enable Debug Logging

The first step in debugging JCR query performance is to enable debug logging:
1. Go to http://host:port/system/console/slinglog
2. Click Add new logger
3. Configure the logger with the following:
Log file: query.log
Log Level: Debug
Loggers:
org.apache.jackrabbit.core.query.QueryImpl
3. Go to http://aemhost:port/crx/de/index.jsp and log in
4. Click on Tools => Query
5. In the bottom Query box, paste the query and click Execute
6. Log in to the AEM server OS and find the crx-quickstart/logs/query.log
7. Open that file in a viewer and you will see details about the query's execution 

Use the Explain Query Tool

You can also leverage the Explain Query Tool which is an out of the box tool in AEM to help you debug query performance.
1. Log in to AEM
2. Go to this URL
http://aemhost:port/libs/granite/operations/content/diagnosis/tool.html/_granite_queryperformance
3. Click on the Explain tab
4. Enter the query and click Explain
5. It will show you which Oak index is being used for the query

Modify index definitions to fix the issue

See the documentation below for details on how to manage and improve indexes in AEM:
1. Query debugging and Oak indexes - https://docs.adobe.com/docs/en/aem/6-3/deploy/platform/queries-and-indexing.html
2. Oak Lucene indexes - https://docs.adobe.com/ddc/en/gems/oak-lucene-indexes.html

עבודה זו בוצעה ברישיון של Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  הודעות המתפרסמות ב- Twitter™‎ ו- Facebook אינן מכוסות בתנאי Creative Commons.

הצהרות משפטיות   |   מדיניות פרטיות מקוונת