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
Queries against Large Numbers of Annotations can overload/lock MySQL #21902
Comments
Note from @DanCech : "It occurs to me that given our usual query patterns ask for data near the current time, an index on org_id, epoch_end would likely be much more efficient for the majority of queries as it'll cut down the number of rows very quickly. Unsure whether org_id, epoch_end, epoch would be worth the overhead, but the main thing is that epoch_end is the useful column for cutting out the majority of rows" |
Still populating my local instance with annotations (following is ~10k), but using Dan's suggestion, which I took as:
Seems to do better:
|
We need both because when using absolute time range in dashboard we only want to get the annotations in that range. |
I'm talking about indexes, not queries. We definitely need both parameters in the query, the point is that if the index order is I'm not sure whether there is a benefit to having |
…rove database query performance (#21915) Drop indices and create new ones and rewrites annotation find query to address performance issues when querying annotation table and there is a large amount of rows. Fixes #21902 Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com> Co-authored-by: Kyle Brandt <kyle@kbrandt.com>
…rove database query performance (#21915) Drop indices and create new ones and rewrites annotation find query to address performance issues when querying annotation table and there is a large amount of rows. Fixes #21902 Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com> Co-authored-by: Kyle Brandt <kyle@kbrandt.com> (cherry picked from commit 5ae9519)
…rove database query performance (#21915) Drop indices and create new ones and rewrites annotation find query to address performance issues when querying annotation table and there is a large amount of rows. Fixes #21902 Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com> Co-authored-by: Kyle Brandt <kyle@kbrandt.com> (cherry picked from commit 5ae9519)
What happened:
MySQL database locks up on Annotation query when there are a large (millions) of annotation rows. Grafana-Server subsequently fails as it loses access to its database.
What you expected to happen:
Queries that don't have to scan the entire table, and lock up the db.
How to reproduce it (as minimally and precisely as possible):
Unhappy Query:
Environment:
Introduced I think in 6.4.x by #17673
TODO:
The text was updated successfully, but these errors were encountered: