Skip to content

Reduce N+1 queries when publishing draft notes

What does this MR do and why?

Use :noteable instead of :noteable_id and noteable_type separately to avoid reloading it multiple times.

It reduces the query count from 135 to 105 for 5 draft notes. NOTE: Previous query count in the spec was without RequestStore caching enabled so the count was higher.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #444592 (closed)

Edited by Sincheol (David) Kim

Merge request reports