Skip to content

Speed up Open list when there are assignee lists

What does this MR do?

When there is an assignee list and the board can show a lot of issues, the Open list can be very slow. This was because the query was essentially repeated inside a NOT IN to exclude issues that are assigned to someone from one of the assignee lists.

Instead, we can simplify the inner query to be a more direct one:

NOT EXISTS (
  SELECT 1
  FROM issue_assignees
  WHERE user_id IN ($assignee_list_users)
    AND issue_id = issues.id
)

Which also performs much better, as well as being simpler to understand.

What are the relevant issue numbers?

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/51184.

Does this MR meet the acceptance criteria?

Merge request reports