Skip to content

Fix N+1 Query Performance Issue in Vets Endpoint-created-by-agentic #85

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

shaykeren
Copy link

This PR addresses the N+1 query performance issue in the Vets endpoint by:

  1. Changing the fetch type from EAGER to LAZY in the Vet entity's specialties relationship
  2. Adding @batchsize annotation to optimize batch loading
  3. Implementing @entitygraph for efficient loading of specialties
  4. Adding database indexes on vet_specialties.vet_id, vet_specialties.specialty_id, and specialties.id

These changes should significantly improve the performance of the /vets.html endpoint by reducing the number of database queries executed.

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.

1 participant