Hi, it seems there is no other way... I managed to get the plan so I could send it as a result for a web service, by doing the following:
I created a class MyAppender that extends AppenderSkeleton. It internally uses a StringBuilder to "record" the log messages. After I set the level debug, and before executing the query, I add an instance of that class as an appender to the logger. queryLogger = org.apache.log4j.Logger.getLogger("org.apache.jackrabbit.oak.query"); customAppender = new MyAppender(); previousLevel = queryLogger.getLevel(); queryLogger.setLevel(Level.DEBUG); queryLogger.addAppender(customAppender); After I execute the query, I get the text the logger registered from my appender, then I remove the appender and set the level the logger previously had. And that's it. String planStuff = customAppender.getText(); queryLogger.setLevel(previousLevel); queryLogger.removeAppender(customAppender); Maybe this will help anyone with a similar need. Regards. Jorge El jue, 15 sept 2022 a las 16:45, Jorge Flórez (< jorgeeduardoflo...@gmail.com>) escribió: > Hello all, > I hope everybody is ok :) > I got some production problems because of my queries (too slow, actually, > traversing nodes) and I would like to know if it is possible to know the > plan that was used, after I used the method execute for the Query object. > I think I got a situation where if the repository had a certain size then > the plan for a query was one and when the repository became larger, the > plan for the query changed. > > Thanks for the help. > > Best regards. > > Jorge > >