Skip to content

Conversation

@shaykeren
Copy link

This PR addresses the N+1 query performance issue in the /vets.html endpoint by implementing the following optimizations:

  1. Changed the Vet entity's specialties relationship from EAGER to LAZY loading
  2. Added @BatchSize optimization for the specialties collection
  3. Added optimized repository methods with join fetch queries to load vets and their specialties in a single query
  4. Updated existing repository methods to use the optimized queries

These changes will significantly reduce the number of database queries executed when fetching vets and their specialties, improving the endpoint's performance.

Testing:

  • The changes maintain the same functionality while improving performance
  • The optimized queries have been tested with the pagination feature
  • Caching is preserved through the @Cacheable annotation

Fixes N+1 Query Performance Issue in Vets Endpoint

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants