Re: [druid-user] List pending queries

Hey Adam,
I believe you are referring to this thread (https://groups.google.com/g/druid-user/c/zuWn83moIIU) w.r.t segment/scan/pending, but in fact, this is a metric Druid emits (either from Historicals or real-time tasks), that shows the number of segments waiting to be scanned (in order to serve queries), see https://druid.apache.org/docs/latest/operations/metrics.html#historical and https://druid.apache.org/docs/latest/operations/metrics.html#real-time.

There is a way to see the number of queries that were executed/succeeded/failed/interrupted, if you include the QueryCountStatsMonitor (see https://druid.apache.org/docs/latest/operations/metrics.html#historical).

TBH, I’m not sure if there’s a way to list the queries that are currently running.

Itai

I see.
So there are 2 partial solutions I can think of:

  1. You can set the query ID yourself, on the query context (“sqlQueryId” for SQL queries, and perhaps “queryId” for native queries). That way, you know the query ID to use for the DELETE API.
  2. I saw this (rather old) answer from Gian, saying that you can set a timeout on the query context, to cancel long queries (https://www.druidforum.org/t/how-to-use-query-cancellation/690).

Anyway, let’s see if anyone else has a better answer for you.

Good luck, I hope you’ll find what you need :slightly_smiling_face: