N1ql monitoring shows permanently running queries


#1

Hi
Our the monitoring in couchbase (servers -> statistics -> n1ql queries/sec) shows constantly running n1ql queries at a rate of 6 queries/sec.
Query monitoring does not show any queries. We cannot attribute these queries to anything as all our services are down. Are these internal operations or are we missing something?
Is there anyway to debug/investigate which queries are running on the system?


#2

select * from system:active_requests; cc @marcoeg


#3

that returns “select * from system:active_requests;” as the only running query


#4

ns_server might running queries to collect statistics at constant interval.
If really want to know you can set completed-threshold:0 and look at system:completed_requests after few secs.

https://docs.couchbase.com/server/5.5/settings/query-settings.html

NOTE: Try reset value after your test otherwise memory usage can grow.


#5

so from that I see queries looking like this:
“statement”: “select max(keyspace_id) id, max(has_primary) has_prim, max(has_second) has_sec, max(secondary_indexes) sec_ind from ( select indexes.keyspace_id, true has_primary from system:indexes where is_primary = true and state = ‘online’ union select indexes.keyspace_id, true has_second, array_agg(indexes.index_key) secondary_indexes from system:indexes where state = ‘online’ and is_primary is missing or is_primary = false group by keyspace_id having keyspace_id is not null union select id keyspace_id from system:keyspaces except (select indexes.keyspace_id from system:indexes where state = ‘online’ union select “” keyspace_id) ) foo group by keyspace_id having keyspace_id is not null order by keyspace_id”,
“userAgent”: “Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:62.0) Gecko/20100101 Firefox/62.0 (Couchbase Query Workbench (5.0.1-5003-enterprise))”,
“users”: “admin”

and

  "state": "completed",
  "statement": "infer `cms_schema`;",
  "userAgent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:62.0) Gecko/20100101 Firefox/62.0 (Couchbase Query Workbench (5.0.1-5003-enterprise))",
  "users": "admin"

Are these normal internal queries?


#6

Figured out it was the workbench UI. Thanks for all your help!


#7

I think those normal. cc @eben


#8

Yes, @vasilys, the query you reported is the one used by the Query Workbench to get a list of buckets and their index status.