forked from digma-ai/otel-sample-app-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Description
Issue Description
The /vets.html endpoint is experiencing performance issues due to N+1 query patterns when loading veterinarians and their specialties.
Root Cause
- The
Vetentity usesFetchType.EAGERfor the specialties relationship, causing unnecessary database queries - Missing optimized query to fetch vets with their specialties in a single operation
- Missing database indexes on the join table columns
Solution
A pull request (#92) has been created with the following changes:
- Changed
FetchType.EAGERtoFetchType.LAZYin theVetentity - Added
JOIN FETCHquery inVetRepositoryfor efficient loading - Added
@EntityGraphfor paginated queries - Added database indexes on
vet_idandspecialty_idcolumns - Implemented query result caching
Expected Outcome
- Reduced number of database queries
- Improved response time for the
/vets.htmlendpoint - Better database performance with proper indexes
- Efficient caching of frequently accessed data
Monitoring
After implementing these changes, we should monitor:
- Response time of the
/vets.htmlendpoint - Number of database queries executed
- Cache hit rates
- Database index usage