I’m running a bunch of queries in my application. I can see that in the admin console that “some” of these queries are taking > 1000ms, but I don’t know which ones.
I can’t obviously see how to gain this information from the console. Is there something I can do to see a list of the actual queries that are running that are taking a long time so I can prioritize their optimization?
Hi Gareth,
the next release will have a number of new features in this area.
Using both N1QL and the admin API, you will, for instance, be able to select active queries (which you could order by execution time), kill a long running query, and even have a log of completed queries that satisfy certain preconditions (e.g. execution time longer that a specific threshold).
Could you tell me the actual version number on “the next release” and whether it’s available as some kind of DP or beta at the moment? I am still in development and would be happy to upgrade.
There’s a new system keyspace called completed_requests which logs all requests that have completed and take longer than a specified amount of time.
The default threshold for logging is 1000ms.
You can
select * from system:completed_requests;
to see them.
You can set the threshold either at query node startup time, by passing the -completed-threshold parameter, e.g.
-completed-limit and “completed-limit”: control how many of the most recent qualifying requests are going to be stored in the completed_requests keyspace.