-
Notifications
You must be signed in to change notification settings - Fork 277
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
[feature]: support sub query/join #882
Comments
If I make any mistakes, please feel free to interrupt me. Joining different databases is not allowed unless there are sufficient reasons and a well-considered time alignment scheme. Although the join condition involves only tags, having the same timestamp for both left and right metrics is an implicit condition. In other words: select metric_a a, metric_b b, metric_c c where a.tag1 = b.tag1
and c.tag2 = b.tag2; Is equivalent to: select metric_a a, metric_b b, metric_c c where a.tag1 = b.tag1
and c.tag2 = b.tag2
and a.timestamp = b.timestamp -- No need to include this sentence; it's just an explanation.
and b.timestamp = c.timestamp; Query amplification may be the most challenging aspect of join operations in a distributed scenario, and there are already many distributed join solutions. Fortunately, Lindb's Therefore, we can adopt a relatively simple approach to address this issue:
Perhaps, before these steps, querying all tag keys and tag values for each metric can be considered, and each execution plan also includes tag conditions. However, this is not mandatory. As for subqueries: select sum(c.f1+c.f2) from (
select a.field1 as f1, b.field2 as f2
from metric_a a, metric_b b
where a.tag1 = b.tag1
and time > time()-1M
) c where c.f1 > 100; It must be a simple subquery, and subquery statements cannot be joined with external statements. Subqueries may also contain subqueries, but the root must extract the innermost subquery statement, specify the query plan, and, similar to implementing join operations, after multiple execution plans return results, the root performs further filtering and aggregation before finally returning the data to the client. |
Yes, just do time series join(metric name + tags) not include timestamp, because all time series must have same time range in all sub queries.
|
I'm marking this issue for now. We'll revisit and aim to implement this feature once task #1015 is completed. |
Is your feature request related to a problem? Please describe.
support sub query/join
Describe the solution you'd like
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered: