Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Which oak:index is being used?

Avatar

Level 4

Is there a way to turn on logging to see which oak:index is being used by a query?

1 Accepted Solution

Avatar

Correct answer by
Level 9

Hi Tom,

Always grep for "query plan".  In your above example it is using property index oclc_start.

Thanks,

View solution in original post

3 Replies

Avatar

Level 9

Hi Tom, 

Explain query tool provide the information you are looking Operations Dashboard  ,   enable debug log on [A] will let you see in log file but will have more additional  info.

[A]

org.apache.jackrabbit.oak.plugins.index

org.apache.jackrabbit.oak.query

Thanks,

Avatar

Level 4

I created a logger for the above. I am not easily able to identify the index being used in a query.

For instance here are two entries from the log. What index is being used?

14.06.2017 08:12:27.612 *DEBUG* [0:0:0:0:0:0:0:1 [1497442347171] GET

/content/research/events/events.html HTTP/1.1] org.apache.jackrabbit.oak.query.QueryImpl query

execute select [jcr:path], [jcr:score], * from [cq:CalendarEvent] as a where [event_tag] like

'research:events' and [start] <= cast('2017-06-13T23:59:59.520-04:00' as date) order by [start] desc

/* xpath: //element(*, cq:CalendarEvent)[(((jcr:like(@event_tag, 'research:events'))) and ((@start

<= xs:dateTime('2017-06-13T23:59:59.520-04:00'))))] order by @start descending */

14.06.2017 08:12:27.612 *DEBUG* [0:0:0:0:0:0:0:1 [1497442347171] GET /content/research/events/events.html

HTTP/1.1] org.apache.jackrabbit.oak.query.QueryImpl query plan [cq:CalendarEvent] as [a] /* property

oclc_start IS NOT NULL where ([a].[event_tag] like 'research:events') and ([a].[start] <=

cast('2017-06-13T23:59:59.520-04:00' as date)) */

Avatar

Correct answer by
Level 9

Hi Tom,

Always grep for "query plan".  In your above example it is using property index oclc_start.

Thanks,