Skip to content

Add a trigram index for routes.path

Nick Thomas requested to merge (removed):31403-route-path-trigram-index into master

What does this MR do?

Adds a trigram index for routes.path

Are there points in the code the reviewer needs to double check?

Is a MySQL equivalent required?

Is this a reasonable approach to the problem? Do sensible alternatives exist?

Should this be a post-deployment migration? I get the feeling adding this index is going to be slow?

Why was this MR needed?

routes.path is btree indexed at present, but this only works for LIKE clauses if the string to compare against is a literal. It cannot be sourced from a column.

Some sites in the GitLab codebase - notably Routable.member_descendents, Routable.member_self_and_descendants and Routable.member_hierarchy, which are used when creating groups, among other things, perform queries that do not meet these requirements.

In these circumstances, adding a trigram improves the performance of these queries significantly.

Fuller analysis, including EXPLAIN charts, can be found in the issue, starting at: https://gitlab.com/gitlab-org/gitlab-ce/issues/31403#note_28297360

Screenshots (if relevant)

Does this MR meet the acceptance criteria?

What are the relevant issue numbers?

Closes #31403 (moved)

Edited by Nick Thomas

Merge request reports