-
Notifications
You must be signed in to change notification settings - Fork 12.2k
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
Database: Fixed slow permission query in folder/dashboard search #17427
Conversation
Did you test it with this test data? #17422 Did you notice that the GetSystemStats query also gets slow? |
@torkelo Did not see that one, created my own script to create the dashboards but will check yours too. |
I also noticed the slow login time |
Added unit tests (tested with previous implementation) so it seems like it works the same so far. In any case some more reviewing is probably in order as this is kinda sensitive query that is added to multiple other queries. |
Tested this now and it does fix both the login & seach issue for me and seems to keep the old behavior / logic |
@torkelo regarding the GetSystemStats query I do not see a huge slowdown with lots of dashboards. The queries there do not use the ACL check subquery. There is some dashboard - dashboard_acl joins that could get slower with number of dashboards but probably not significantly and it should be easily cached by the DB. |
Regarding GetSystemStats , I was reading the output wrong it took 18ms not 18 seconds |
Fix slow ACL query for dashboards that was used as subquery on multiple places slowing down search and login in instances with many dashboards. (cherry picked from commit 1c3ad78)
Fix slow ACL query for dashboards that was used as subquery on multiple places slowing down search and login in instances with many dashboards. (cherry picked from commit 1c3ad78)
* grafana/master: Prometheus: Use overridden panel range as $_range instead of dashboard range (grafana#17352) Update latest (grafana#17456) NavModel: Fixed page header ui tabs issues for some admin pages (grafana#17444) Update changelog for 6.2.2 (grafana#17452) PluginConfig: Fixed plugin config page navigation when using subpath (grafana#17364) Tracing: allow propagation with Zipkin headers (grafana#17009) Perf: Fix slow dashboards ACL query (grafana#17427) Explore: Fixes crash when parsing date math string with whitespace (grafana#17446) Cloudwatch: Add AWS DocDB metrics (grafana#17241) Provisioning: Support folder that doesn't exist yet in dashboard provisioning (grafana#17407) Codestyle: Fix govet issues (grafana#17178)
Fixes: #17336
The issue seems to be in one join that adds default permissions that creates N x N row that needs to be filtered (for ~9k dashboards that is around 80m rows). Moving the default permissions to separate select and union-ing them seems to fix the issue while preserving the same results. The UI is still not supper snappy but it seems more of an issue of rendering too many dashboards in the search. I think we could just limit returned dashboards quite a bit.
explain analyze before:
after:
TODO: