-
Notifications
You must be signed in to change notification settings - Fork 75
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
Optimize OTel Trace ID queries with skip index #725
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🎉
Just two nits, up to you on how you want to handle them 😎
Good points on the otel functions, pushed a change to clean up the imports/references 👌 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🏆 nicely done
FYI this query scans the trace_id_ts table twice. Compare with: (SELECT (min(start), max(end) + 1) FROM tracing.otel_traces_trace_id_ts WHERE trace_id = ID) as bounds,
...
AND startTime >= bounds.1
AND startTime <= bounds.2 |
Very good point, this PR was simply using the linked query on the original issue, but this seems like another optimization we can add. Thanks! |
Adds the optimization requested in #724
This optimization is only included in the SQL when OTel is enabled since the table is specific to OTel.
Here's the new SQL that is generated for Trace ID queries:
Here's a rough graph of query duration before and after:
