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

resolve N+1 queries #400

Closed
mtracz opened this issue Feb 27, 2024 · 0 comments · Fixed by #407
Closed

resolve N+1 queries #400

mtracz opened this issue Feb 27, 2024 · 0 comments · Fixed by #407
Labels
bug obviously bugged thing - to immediately fix

Comments

@mtracz
Copy link
Member

mtracz commented Feb 27, 2024

Bug description

Sentry reports N+1 Query problem.
select * from "vacations" where "vacations"."vacation_request_id" = ? and "vacations"."vacation_request_id" is not null
https://blumilk.sentry.io/issues/4868147428/?project=4505271823237120&query=is%3Aunresolved&referrer=issue-stream&statsPeriod=30d&stream_index=0
Additionally there other models which are lazy loaded (Attempted to lazy load [roles] on model [Spatie\Permission\Models\Permission] but lazy loading is disabled.).

Reproduction steps

Steps to reproduce the behavior:

  1. Enable Model::preventLazyLoading(); in boot() in AppServiceProvider
  2. Login to the app

Expected behavior

There should not be N+1 queries and Eloquent models should not be lazy loaded.

Screenshots
image

image

Environment

  • OS:
  • Browser:
@mtracz mtracz added the bug obviously bugged thing - to immediately fix label Feb 27, 2024
kamilpiech97 added a commit that referenced this issue Mar 19, 2024
kamilpiech97 added a commit that referenced this issue Mar 20, 2024
kamilpiech97 added a commit that referenced this issue Mar 20, 2024
kamilpiech97 added a commit that referenced this issue Mar 20, 2024
* #400 - fixed n+1 quries in app

* - fix

* #400 - merged main

* #400 - added debugbar
kamilpiech97 added a commit that referenced this issue Mar 25, 2024
* #400 - fixed n+1 quries in app

* - fix

* #398 - wip

* #398 - tidy up queries

* #398 - wip

* - merged main

* #398 - fix

* - laod fix

* #398 - update

* - cr fixes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug obviously bugged thing - to immediately fix
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant