Skip to content
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

N+1 Queries in Owners endpoint #1302

Open
tekshteint opened this issue Jul 22, 2023 · 1 comment
Open

N+1 Queries in Owners endpoint #1302

tekshteint opened this issue Jul 22, 2023 · 1 comment

Comments

@tekshteint
Copy link

tekshteint commented Jul 22, 2023

While digging around the Spring Petclinic I found this issue running digma.ai on the project. The n+1 situation arises in two situations:

  1. Making a parameterless GET request on /owners
  2. Using the webpage and searching for an empty string

We can see that in the traces, side panel, and even the query behind the issue. This issue can be replicated using a simple shell script to concurrently load the /owners endpoint or even just running an empty string search a few times from the webpage.
BeforeTrace
SidePaneView
AfflictingQuery

My proposed fix resolves the n+1 issue and reduces the amount of un-necessary queries. We can see that in the new traces and the updated side panel view when testing in the same manner. Here's the new query I used to resolve this issue.
AfterTrace
AfterOverview
AfterQuery

@dsyer
Copy link
Member

dsyer commented Aug 24, 2023

Bear in mind though that n=5, so I don't think it's necessarily a huge problem. Thanks for the pull request though.

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

No branches or pull requests

3 participants
@dsyer @tekshteint and others