Skip to content
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

generate a better optimized query for path prefix search filters #28608

Merged
merged 1 commit into from
Oct 7, 2021

Conversation

icewind1991
Copy link
Member

If we're already doing a path LIKE "$prefix/%" then doing a path = "$prefix" doesn't incur the cost it normally does compared to path_hash = md5("$prefix"), and by only selecting on the path column instead of 2 columns the same index can be used for both comparisons.

Combined with #28541 this gets mysql to do a proper indexed search (in my testing at least)

Signed-off-by: Robin Appelman <robin@icewind.nl>
Copy link
Member

@PVince81 PVince81 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks fine 👍

Assuming this won't affect other database engines negatively

@PVince81 PVince81 merged commit f518710 into master Oct 7, 2021
@PVince81 PVince81 deleted the path-prefix-filter branch October 7, 2021 15:16
@icewind1991
Copy link
Member Author

/backport to stable22

@skjnldsv
Copy link
Member

/backport to stable21

@skjnldsv
Copy link
Member

/backport to stable20

@backportbot-nextcloud
Copy link

The backport to stable21 failed. Please do this backport manually.

@backportbot-nextcloud
Copy link

The backport to stable20 failed. Please do this backport manually.

@icewind1991
Copy link
Member Author

see #29080 for the 21 and 20 backports

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants