Skip to content

Conversation

@arthurrump
Copy link
Member

Description

Fixes #141 (hopefully)

This PR replaces the slow database queries that are currently used for mentions.

  • User resolution after commenting
    This is currently a full table scan as the result of a query that checks for every name if it is a prefix of the possible mention string. It will be replaced by a cached tree-based longest prefix match.
  • User search for mention suggestions
    This is also a full table scan, just like all other search queries (yes, really), due to the use of LIKE '%?%' to find matches. Postgres does not seem to have any index that could handle that well, so it will be replaced by a full-text search index. This will probably also allow for more fuzzy matches.

Checklist

  • ESLint is happy about the added code

  • All tests pass (I have checked)

  • This PR is concerned with a new feature or a bug fix on the backend, and

    • New tests have been added to show that it works
    • Documentation has been updated if necessary
  • This PR is concerned with changes on the frontend, and

    • I have verified that they work
    • Screenshots of visual changes are included below

The db query formerly responsible for resolving a mentioned user could
not use any index, so it resulted in a full table scan. Now we request all
users at most once per hour and build a fast tree lookup (which is cached
between requests) to resolve users instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants