-
Notifications
You must be signed in to change notification settings - Fork 7k
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
ABC-79: Optimize channel autocomplete query #8163
Conversation
@ccbrown Are we going to apply the same to user autocomplete? (and perhaps emoji autocomplete) |
@jasonblais I think we should, but I think we should make separate JIRA issues and PRs for them. |
@jasonblais as is, this is going to change more than just the behaviour of the channel autocomplete but also anywhere we have channel search as well. The case I'm thinking of is in the 'More Channels' modal, it's going to be much faster but it's going to show arbitrary results like it will for the autocomplete. Is that OK? Personally I think it makes more sense to have a dedicated autocomplete API endpoint for this fast query and the regular search endpoint is slower but more accurate. Or at least it should be a query parameter on the search endpoint |
@ccbrown Propose we only change the channel linking autocomplete. Other searches such as the "More Channels" dialog, results aren't expected to be arbitrary. Plus we might add paging to search results later, in which case we display more than just the first 100 results. /cc @jwilander |
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.
See comments.
Also, created a ticket for optimizing user autocomplete query. https://mattermost.atlassian.net/browse/ABC-201
store/sqlstore/channel_store.go
Outdated
ORDER BY DisplayName | ||
LIMIT 100` | ||
%v | ||
LIMIT 50` |
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.
Why 50?
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.
We mentioned reducing the number of results returned in our discussion, and there didn't seem to be any opposition to the idea. 50 is still twice as many results as slack (and 5x Discord).
Is it possible the new behavior is going to be hard on users? Is this something that could/should be feature flagged? @ccbrown |
@jasonblais This review now changes no behavior, but adds an additional API endpoint for channel autocomplete. I'll put in the reviews for the 3 other repos that will need to be updated soon. @csduarte I don't really think anyone will notice a difference in the results; only that they'll get autocomplete results potentially several hundred times faster. |
Do you mean "More Channels" search still shows X arbitrary results? Or only the channel autocomplete. |
@jasonblais I mean absolutely no behavior is changing with this PR. Everything is exactly as it was before. The behavior will change once I get the other PRs in and have the client use the new endpoint that this adds. |
@ccbrown Mm, right. Got it. I'll test the client-side PR then. |
@jwilander @grundleborg Ready for your reviews. |
Summary
As discussed in this very long thread, this changes the autocomplete query to return an arbitrary subset of results rather than the first X in the complete, sorted result set.
The impact on some autocomplete searches on my local database with over ~400,000 in-team channels prefixed with "channel":
There are more things I could do to reduce those "~c..." cases down to a few milliseconds as well, but I'm suspecting that 400,000+ matching channels is not the norm, so it would probably be premature to put much effort into that.
Ticket Link
https://mattermost.atlassian.net/browse/ABC-79
I'm going to close this ticket with this PR as I think this resolves the biggest issues (The user performance isn't anywhere near as bad as the channel performance was.). We can create new issues as needed.
Checklist
N/A