Skip to content

Conversation

@gianm
Copy link
Contributor

@gianm gianm commented Jan 16, 2026

The sys.queries table provides insight into currently-running queries. It provides the same information as the /druid/v2/sql/queries API. As such, it currently only works with Dart.

In this patch the table is documented, but off by default. It can be enabled by setting druid.sql.planner.enableSysQueriesTable = true.

This patch additionally adds an includeComplete parameter to /druid/v2/sql/queries, which is used by the implementation of the sys.queries table, to allow it to show information for recently-completed queries.

The sys.queries table provides insight into currently-running queries.
It provides the same information as the /druid/v2/sql/queries API. As such,
it currently only works with Dart.

In this patch the table is documented, but off by default. It can be
enabled by setting druid.sql.planner.enableSysQueriesTable = true.

This patch additionally adds an "includeComplete" parameter to
/druid/v2/sql/queries, which is used by the implementation of the
sys.queries table, to allow it to show information for recently-completed
queries.
@github-actions github-actions bot added Area - Documentation Area - Batch Ingestion Area - Querying Area - MSQ For multi stage queries - https://github.com/apache/druid/issues/12262 labels Jan 16, 2026
Copy link
Contributor

@capistrant capistrant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool stuff! I think the bot report re redundant toString is accurate and could be cleaned up. I also left note in the docs to make sure we aren't missing any disclaimer about why this is off by default, if there is such a reason beyond it being experimental.

* @param roleName the role name to create and assign
* @param permissions the permissions to grant to the role
*/
public static void createUserWithPermissions(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

```
```

### QUERIES table
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this being off by default, I guess it would make me think as an operator that there is either a cost or a risk to turning it on. I don't think risk, but cost, maybe? Or is this just how we have operated with new sys tables in past, feature flag them, and once non-experimental remove the flag?

If there is a consideration an operator should take beyond "this is off by default cuz it is experimental" then I think we should add such a disclaimer here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking it's because it only works with Dart, and Dart is experimental, so this should be experimental too by transitivity. I will add that to the docs.

{
// Create mock SqlEngine that returns test queries
final SqlEngine mockEngine = EasyMock.createMock(SqlEngine.class);
EasyMock.expect(mockEngine.name()).andReturn("native").anyTimes();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just showing the native engine some love by using it in the mocks so it isn't feeling left out by not being in the real thing?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it'd support native one day 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area - Batch Ingestion Area - Dependencies Area - Documentation Area - MSQ For multi stage queries - https://github.com/apache/druid/issues/12262 Area - Querying

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants