[v10.2.x] Search: Modify query for better performance #77713
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Backport f999fe3 from #77576
What is this feature?
A customer has reported that they managed to improve search performance in their instance by introducing an index on
dashboard.uid
.After investigation we realised that the
UQE_dashboard_org_id_uid
was not used.This fix modifies the query to add
org_id
in the condition so that the above index is used.It re-introduces also benchmarking accessControlDashboardPermissionFilter permissions filter (in addition to the experimental accessControlDashboardPermissionFilterNoFolderSubquery one)
Why do we need this feature?
Execution plan for the query before the fix
Execution plan the query after the fix
The difference is in subquery
d
.Who is this feature for?
[Add information on what kind of user the feature is for.]
Which issue(s) does this PR fix?:
Fixes #
Special notes for your reviewer:
Query diff before and after the fix
I have run benchmarks before and after the fix and you can examine the results below:
benchstat results
Please check that: