[ 
https://issues.apache.org/jira/browse/OAK-6807?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16222349#comment-16222349
 ] 

Thomas Mueller commented on OAK-6807:
-------------------------------------

Example usage to get the list of queries:
* Enable _debug_ level logging for module 
{{org.apache.jackrabbit.oak.query.stats.QueryRecorder}} to file 
{{query-recorder.log}}
* Let it collect queries
* To get the list of queries, run
{noformat}
grep "*DEBUG*" .../query-recorder.log | cut -f4
{noformat}
Only unique query "shapes" are collected (for example, text literals are all 
replaced with 'x'), so if a query is run multiple times, it is logged only once.
To log and show the raw queries, enable _trace_ level logging, and then run:
{noformat}
grep "*TRACE*" .../query-recorder.log | cut -f2
{noformat}


> Query Recorder
> --------------
>
>                 Key: OAK-6807
>                 URL: https://issues.apache.org/jira/browse/OAK-6807
>             Project: Jackrabbit Oak
>          Issue Type: Improvement
>          Components: query
>            Reporter: Thomas Mueller
>            Assignee: Thomas Mueller
>             Fix For: 1.7.11
>
>
> In order to manage indexes (e.g. find out which indexes are no longer needed, 
> which properties don't need to be indexed any longer), we have an easy way to 
> log all executed queries / query plans. 
> Each entry only needs to be logged once (logging multiple times is OK, but 
> ensure it's not logged to often). Different log levels can be used (e.g. log 
> level "TRACE" logs more data, "DEBUG" less). For "DEBUG" level, overhead of 
> logging should be minimal, so this can be kept enabled for a long time.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to