Closed krzys-h closed 2 years ago
Properties such as Workshop.solution_count are an easy way to introduce N+1 errors in the ORM. Instead, we should remove the property and define a custom ObjectManager with a method with_counts that adds the required data at the query level.
Workshop.solution_count
with_counts
Properties such as
Workshop.solution_count
are an easy way to introduce N+1 errors in the ORM. Instead, we should remove the property and define a custom ObjectManager with a methodwith_counts
that adds the required data at the query level.