How to see query being executed in coucbase when I am running test OR want to see queries executed in last 5 minute


#1

Hi
I am having cluster of couchbase.

What I am trying:-
I am running test on my application and trying to see which queries were being executed at couchbase UI

Facing issue:-

When I am running below command its not giving satisfying output

SELECT elapsedTime,node,serviceTime,statement,SUBSTR(time,0,19)as time FROM system:completed_requests where time > REPLACE(DATE_ADD_STR(NOW_STR(),-5,“second”),“T”," ") order by serviceTime desc

Output:
[
{
“elapsedTime”: “9.866527481s”,
“serviceTime”: “9.866458607s”,
“statement”: “SELECT ‘’ FROM system:indexes WHERE name = “temp_index”",
“time”: “2018-05-10 17:08:08”
},
{
“elapsedTime”: “9.837083772s”,
“serviceTime”: “9.837009681s”,
“statement”: “SELECT name FROM system:indexes WHERE keyspace_id = “com.amdocs.digital.ms.pod.search.temp””,
“time”: “2018-05-10 17:09:10”
},
{
“elapsedTime”: “9.741569097s”,
“serviceTime”: “9.741510834s”,
“statement”: "SELECT '
’ FROM system:indexes WHERE name = “idx_relatedPartyRole””,
“time”: “2018-05-10 17:17:35”
},
{
“elapsedTime”: “9.72482201s”,
“serviceTime”: “9.724759417s”,
“statement”: "CREATE PRIMARY INDEX ct-primary-index ON com.amdocs.digital.ms.productconfigurator.qualification",
“time”: “2018-05-10 16:38:04”
},

Can anyone suggest?


#2

system:completed_requests will have only queries took more than 500ms. It is configurable. cc @marcoeg

Date manipulation functions https://developer.couchbase.com/documentation/server/current/n1ql/n1ql-language-reference/datefun.html

DATE_ADD_STR(NOW_STR(),-5,“second”) ===> this only gives 5sec you need to use “minute” for 5min