Skip to content
  • Stan Hu's avatar
    Eliminate N+1 queries in loading discussions.json endpoint · 8690ca5c
    Stan Hu authored
    In #37955,we see that the profile had a number of N+1 queries from repeated
    access to `cross_reference_not_visible_for?`. This was optimized in previous
    versions of GitLab by rendering all notes at once, counting the number of
    visible references, and then using that number to check whether a system note
    should be fully redacted.
    
    There was also another N+1 query calling `ProjectTeam#member?`, which did not
    take advantage of an optimization in prepare_notes_for_rendering that would
    preload the maximum access level per project.
    
    Closes #37955
    8690ca5c