-
Use
sizeinstead ofcountFor AR relations, as is considers whether the relation has been loaded already instead of re-doing a COUNT query over and over.
- Add DB indexes
- Avoid N+1
Use size instead of count
For AR relations, as is considers whether the relation has been loaded already instead of re-doing a COUNT query over and over.