Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EPIC] Support table style queries in the layer #5742

Open
Tracked by #5738
evanh opened this issue Apr 10, 2024 · 1 comment
Open
Tracked by #5738

[EPIC] Support table style queries in the layer #5742

evanh opened this issue Apr 10, 2024 · 1 comment

Comments

@evanh
Copy link
Member

evanh commented Apr 10, 2024

There is a common use case in the product of wanting to create a table, where each row is grouped by a tag column, and there are multiple aggregates.

Image

It's possible to create a such a table with a single SnQL query (assuming all the aggregates are in the same table) however that's not the case with MQL. The current process is to make the first query to fetch the set of grouped by values {V}, and then make N more queries with a filter on column IN {V}. This gets more complicated since the table can also be ordered by any column in the table, and changing the order requires rerunning all N queries with new filters.

Once we support JOIN queries to build multi-type formulas, we should be able to use a similar principle to return an entire table in a single query.

For example (this is pseudocode)

SELECT transaction, c.sum(value) AS sum, d.quantiles(99)(value) AS p99
FROM counters c JOIN distributions d ON c.transaction = d.transaction
GROUP BY transaction
ORDER BY p99 DESC
@evanh
Copy link
Member Author

evanh commented Apr 10, 2024

Depends on #5738

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant