Skip to content

Follow Up: Autocomplete Group Users to use distinct_each_batch

Omar Qunsul requested to merge 420387-using-distinct-each-batch-on-members into master

What does this MR do and why?

This MR is Addressing: #431708 (closed)

A previous merged MR tried to resolve the issues on Autocomplete::UsersFinder when we search for users within a group. The new code was released behind a feature flag.

The previous MR performed badly on GPRD when it was enabled for few users, and tested with Autocomplete on gitlab-org.

This MR is to address a suggestion by @engwan, and previously by @jhyson mentioned it here by reading the user_ids from the members table distinctly instead, in an effort to reduce the number of each_batch queries that are issued to the database.

New database queries introduced in this MR.

  1. First distinct_each_batch query: https://postgres.ai/console/gitlab/gitlab-production-tunnel-pg12/sessions/24310/commands/77671
  2. Second distinct_each_batch query: https://postgres.ai/console/gitlab/gitlab-production-tunnel-pg12/sessions/24310/commands/77672

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #420387 (closed)

Edited by Omar Qunsul

Merge request reports