Optimize page loading of Admin::RunnersController#show
This commit optimizes the page loading of this page in several ways:
-
Remove exact counting of projects on the page. By default, a
SELECT COUNT(*) FROM projects
would be called, which could take seconds on an instance with many projects. Now we paginate without exact counts, which causes only thePrev
andNext
buttons appear instead of a numbered set. -
Preload project/namespace/routes where necessary. This reduces a significant number of N+1 queries.
-
Remove the use of
becomes(Namespace)
because this causes a SQL query each time it is called. Instead, use the Rails path helpers to generate the path directly viaproject.namespace
.
Closes #119093 (closed)
Edited by Stan Hu