The Vets endpoint (/vets.html) is experiencing an N+1 query performance issue due to eager loading of specialties for each vet.
Problem:
- The
Vet entity uses EAGER fetching for the specialties relationship
- This causes a separate query for each vet's specialties
- No database indexes on the join table columns
Solution:
- Changed fetch type to LAZY with @batchsize optimization
- Added @entitygraph for efficient loading
- Added database indexes on:
- vet_specialties.vet_id
- vet_specialties.specialty_id
- specialties.id
Related PR: #85