Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events
SOLVED

What is "cost for traverse is ?

Avatar

Level 7

{
"statement": "/jcr:root/content/dam//element(*, dam:Asset)",
"language": "xpath",
"explain": {
"logs": [
"Parsing xpath statement: explain /jcr:root/content/dam//element(*, dam:Asset)\r\n",
"XPath > SQL2: explain select [jcr:path], [jcr:score], * from [dam:Asset] as a where isdescendantnode(a, '/content/dam') /* xpath: /jcr:root/content/dam//element(*, dam:Asset) */\r\n",
"cost using filter Filter(query=explain select [jcr:path], [jcr:score], * from [dam:Asset] as a where isdescendantnode(a, '/content/dam') /* xpath: /jcr:root/content/dam//element(*, dam:Asset) */, path=/content/dam//*)\r\n",
"cost for reference is Infinity\r\n",
"cost for property is Infinity\r\n",
"cost for nodeType is Infinity\r\n",
"Applicable IndexingRule found IndexRule: nt:base\r\n",
"Applicable IndexingRule found IndexRule: nt:base\r\n",
"Applicable IndexingRule found IndexRule: nt:base\r\n",
"Applicable IndexingRule found IndexRule: nt:base\r\n",
"Applicable IndexingRule found IndexRule: nt:base\r\n",
"Applicable IndexingRule found IndexRule: nt:base\r\n",
"Applicable IndexingRule found IndexRule: dam:Asset\r\n",
"cost for [/oak:index/damAssetLucene] of type (lucene-property) with plan [lucene:damAssetLucene(/oak:index/damAssetLucene) :ancestors:/content/dam] is 388.00\r\n",
"cost for lucene-property[/oak:index/damAssetLucene] is 388.0\r\n",
"cost for aggregate lucene is Infinity\r\n",
"looking for plans for paths : []\r\n",
"cost for solr is Infinity\r\n",
"cost for traverse is 6244.0\r\n"
],
"plan": "[dam:Asset] as [a] /* lucene:damAssetLucene(/oak:index/damAssetLucene) :ancestors:/content/dam where isdescendantnode([a], [/content/dam]) */",
"propertyIndexes": [
"damAssetLucene(/oak:index/damAssetLucene)"
]
},
"heuristics": {
"count": 386,
"countTime": 7,
"executionTime": 1,
"getNodesTime": 0,
"totalTime": 8
}
}

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @akshaybhujbale,

As far as I know cost for traverse indicates number of nodes that needs to be read (traversed) by search engine base on query criteria to give you a final result.

In general traversing is ineffective method of searching the JCR tree, no index is in use during this operation. Traversing processes whole tree or its sub-tree reading node by node. This is also why AEM has a of number of nodes that can be visited in a single query run. Default it is set to 100000 nodes. It can be configured via Apache Jackrabbit Query Engine Settings Service OSGi configuration.

Here is very detailed recording that describes indexing query, troubleshooting that may interest you:

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

Hi @akshaybhujbale,

As far as I know cost for traverse indicates number of nodes that needs to be read (traversed) by search engine base on query criteria to give you a final result.

In general traversing is ineffective method of searching the JCR tree, no index is in use during this operation. Traversing processes whole tree or its sub-tree reading node by node. This is also why AEM has a of number of nodes that can be visited in a single query run. Default it is set to 100000 nodes. It can be configured via Apache Jackrabbit Query Engine Settings Service OSGi configuration.

Here is very detailed recording that describes indexing query, troubleshooting that may interest you:

Avatar

Community Advisor

Here is the jackrabbit documentation for how the cost is calculated

Manikumar_0-1670253703439.png

 

Refer the documentation fro more information

https://jackrabbit.apache.org/oak/docs/query/query-engine.html#cost-calculation

 

Hope this is helpful