Is there a way to see N1QL queries in the console?

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).

HTH,
Marco

1 Like

Great, thanks!

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.

@gareth as far as I know there is a DP on the horizon, but no official date yet. @cihangirb?

We hope to showcase a preview in Feb but it depends on how fast we hit the quality bar. The release is codenamed “watson” in JIRA.
-cihan

Very nice !
Can’t wait the next version :slight_smile:

I’ve installed the 4.5DP and, if this feature is there, I’m not seeing how to get to it.

Is it there? If so, how do I get to it?

Thanks

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.

start-cbq-engine.sh other parameters -completed-threshold 500

or you can modify it on the fly from the /admin/setting endpoint

curl -X POST ‘http://your query host:8093/admin/settings’
-u Administrator:password -d ‘{“completed-threshold”: 500 }’

-completed-limit and “completed-limit”: control how many of the most recent qualifying requests are going to be stored in the completed_requests keyspace.

HTH,
Marco

you can also find detiails here in the documentation: http://developer.couchbase.com/documentation/server/4.5-dp/query-monitoring.html