The UserCollectionRepository.findByUserIdSorted() and UserWantlistRepository.findByUserIdSorted() methods trigger separate queries for each release relation. With large collections, this causes response times to increase linearly, risks database connection pool exhaustion, and creates poor performance for users with 100+ items in their collections.
Proposed Solution
Use TypeORM's leftJoinAndSelect for eager loading of release data in a single query. Alternatively, implement the DataLoader pattern for batched loading of relations. Add query performance monitoring to track improvements and ensure consistent performance regardless of collection size.
The
UserCollectionRepository.findByUserIdSorted()andUserWantlistRepository.findByUserIdSorted()methods trigger separate queries for each release relation. With large collections, this causes response times to increase linearly, risks database connection pool exhaustion, and creates poor performance for users with 100+ items in their collections.Proposed Solution
Use TypeORM's
leftJoinAndSelectfor eager loading of release data in a single query. Alternatively, implement the DataLoader pattern for batched loading of relations. Add query performance monitoring to track improvements and ensure consistent performance regardless of collection size.