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

FTS speedup #7259

Merged
merged 3 commits into from
Jan 18, 2023
Merged

FTS speedup #7259

merged 3 commits into from
Jan 18, 2023

Conversation

kozlovsky
Copy link
Contributor

This PR removes a trailing * symbol from the FTS queries.

The last search word is treated as a prefix with a trailing star symbol. Due to this, queries like "1" can look up all words starting with this prefix (numbers in this example). As a result, the query can attempt to fetch many millions of rows from the database, and fetching and ordering all those rows can take a very long time. The query result, in that case, can include a large number of irrelevant results.

Removing the trailing * symbol produces higher-quality search results and speeds up some queries up to two orders of magnitude. Without trailing * symbols, non-exact matches are still included in the query result, as the FTS query performs stemming.

@kozlovsky kozlovsky requested review from a team and xoriole and removed request for a team January 13, 2023 13:46
@kozlovsky kozlovsky force-pushed the fts_speedup branch 2 times, most recently from abe2279 to a1693f3 Compare January 16, 2023 13:29
@kozlovsky kozlovsky merged commit 5304864 into Tribler:main Jan 18, 2023
@kozlovsky kozlovsky deleted the fts_speedup branch January 18, 2023 10:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants