Skip to content

Reduce SQL requests number for epic issues

Igor Drozdov requested to merge id-n-1-for-epic-issues into master

What does this MR do?

When API request performed for multiple milestone issues the number of SQL requests depends on the number of issues. Let's preload the associations to fix it. There is still an N + 1 for calculating subscribed? field, but we'll tackle it in: #325898 (closed)

Also pagination is added to limit the returned results

The endpoint produces one of the highest average numbers of SQL requests: https://dashboards.gitlab.net/d/api-rails-controller/api-rails-controller?viewPanel=2155933118&orgId=1&var-PROMETHEUS_DS=Global&var-environment=gprd&var-stage=main&var-controller=Grape&var-action=All

That also happens due to the missing pagination. This merge request adds it as well

Edited by Igor Drozdov

Merge request reports

Loading