Hi Team,
We got the list of popular queries made under our system. out of which the below query I am not able to find the source, but it seems to be an OOB query, but anyone, please let me know the cause of the below AEM query:
SELECT * FROM [nt:base] WHERE [jcr:uuid] = $id OPTION(INDEX NAME [uuid], INDEX TAG [uuid])
Thanks
@kautuk_sahni @lukasz-m @arunpatidar @SantoshSai
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @tushaar_srivastava ,
The query you're seeing:
SELECT * FROM [nt:base] WHERE [jcr:uuid] = $id OPTION(INDEX NAME [uuid], INDEX TAG [uuid])
is an out-of-the-box (OOB) query used internally by AEM and JCR (Jackrabbit Oak) for resolving nodes by UUID. Here’s a breakdown:
What this query does
- It fetches a node from the JCR repository using its UUID (jcr:uuid).
- nt:base is the base node type—so this query matches any node type.
- The OPTION(INDEX NAME [uuid], INDEX TAG [uuid]) hint tells Oak to use the uuid index, which improves performance when looking up nodes by UUID.
Why and where it is used
This is typically used in:
- References Resolution (e.g., from Reference or WeakReference properties).
- Replication or Version Restore operations.
- Permission Evaluation or Audit Tools.
- Admin search UIs or Sling ResourceResolver when a resource is accessed directly by UUID.
Action to take
No issue unless it shows abnormal usage or performance impact.
Check if:
- Custom components are trying to resolve by UUID excessively.
- Any workflow/process is looping over UUIDs.
- Use AEM's Query Performance Tool (http://localhost:4502/libs/granite/operations/content/diagnosistools/queryPerformance.html) to trace what is issuing the query, or enable debug logs for:
org.apache.jackrabbit.oak.query.QueryEngineImpl
org.apache.jackrabbit.oak.plugins.index
Regards,
Amit
Hi @tushaar_srivastava ,
The query you're seeing:
SELECT * FROM [nt:base] WHERE [jcr:uuid] = $id OPTION(INDEX NAME [uuid], INDEX TAG [uuid])
is an out-of-the-box (OOB) query used internally by AEM and JCR (Jackrabbit Oak) for resolving nodes by UUID. Here’s a breakdown:
What this query does
- It fetches a node from the JCR repository using its UUID (jcr:uuid).
- nt:base is the base node type—so this query matches any node type.
- The OPTION(INDEX NAME [uuid], INDEX TAG [uuid]) hint tells Oak to use the uuid index, which improves performance when looking up nodes by UUID.
Why and where it is used
This is typically used in:
- References Resolution (e.g., from Reference or WeakReference properties).
- Replication or Version Restore operations.
- Permission Evaluation or Audit Tools.
- Admin search UIs or Sling ResourceResolver when a resource is accessed directly by UUID.
Action to take
No issue unless it shows abnormal usage or performance impact.
Check if:
- Custom components are trying to resolve by UUID excessively.
- Any workflow/process is looping over UUIDs.
- Use AEM's Query Performance Tool (http://localhost:4502/libs/granite/operations/content/diagnosistools/queryPerformance.html) to trace what is issuing the query, or enable debug logs for:
org.apache.jackrabbit.oak.query.QueryEngineImpl
org.apache.jackrabbit.oak.plugins.index
Regards,
Amit
SELECT * FROM [nt:base]
: This fetches all node types extending from nt:base
, which includes all nodes in the JCR repository.
WHERE [jcr:uuid] = $id
: This filters nodes by their universally unique identifier (jcr:uuid
). $id
is a placeholder for the actual UUID value.
OPTION(INDEX NAME [uuid], INDEX TAG [uuid])
: This hints to the query engine to use a specific index (by name or tag) to speed up the query.
This is a system-level or internal query typically generated by:
AEM internals: For example, when resolving references to specific nodes by UUID (e.g., ReferenceSearch
, PageManager.getPage(String path)
behind the scenes, etc.).
Sling or JCR API usage: If any code (OOB or custom) uses Session.getNodeByIdentifier()
or similar, this query is executed under the hood.
Touch UI / Classic UI authoring interfaces: UUID-based lookups can happen during drag-and-drop references, metadata resolution, etc.
Replication, workflows, or DAM references: When checking or resolving binary or node references by UUID.
Hope that helps!
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies