Skip to content

Eager load award emoji on notes and participants

Zeger-Jan van de Weg requested to merge optimize-award-emoji into master

What does this MR do?

Reduce the query count of the Issuable#show actions. I've create a MR and Issue both now have 108 notes on them, no award emoji, but even than without this MR it had 340+ queries. I've identified 2 problems:

  1. Award Emoji on notes were loaded only when rendering the discussion, thus for each one a query
  2. Participants queries the db once per note now too

Why was this MR needed?

N + 1 queries everywhere. 340+ queries should be lowered to below 100 at least.

What are the relevant issue numbers?

Should fix #18408 (closed), also @yorickpeterse @DouweM

Does this MR meet the acceptance criteria?

Progress

Ref Issue#show MR#show
master 714 1182
a8be992b 387 unchanged
103e285c unchanges 1034

The refs above are squashed together in 5b290fd, the head of this branch.

Merge request reports