Skip to content

Fix N+1 in projects REST endpoint and forked projects

What does this MR do?

When retrieve projects from the /projects REST endpoint and there are several forked projects, some N+1 are present. In this MR we fix the N+1 in the namespace, project_features, and users field of forked projects.

Before the MR, the namespace for forked projects behaved like this:

namespaces_ANTERIOR

With the preload of that relation, the new query is:

Namespaces_DESPUES

The project_features relation also behaved badly formerly:

project_features_ANTERIOR

With the preload:

Project_features_DESPUES

Lastly, the users also presented an N+1 when trying to render the avatar url:

users_ANTERIOR

But now with the preload:

users_DESPUES

Does this MR meet the acceptance criteria?

Conformity

Related to #21121 (closed)

Merge request reports