Skip to content

Fix N+1 queries detected by Bullet#2665

Open
mroderick wants to merge 1 commit into
masterfrom
bullet-n-plus-one-fixes
Open

Fix N+1 queries detected by Bullet#2665
mroderick wants to merge 1 commit into
masterfrom
bullet-n-plus-one-fixes

Conversation

@mroderick

Copy link
Copy Markdown
Collaborator

What

Fixes N+1 queries caught by the Bullet gem during development.

Changes

  • Eager load organisers on Workshop and Event queries in the events controller (both upcoming and past views)
  • Remove unused eager loading of venue and permissions on Meeting queries
  • Enable Bullet.raise = true in development to surface issues immediately

Verification

  • /events/upcoming loads without Bullet::Notification::UnoptimizedQueryError
  • /events/past loads without Bullet::Notification::UnoptimizedQueryError

…ueries

Bullet detected N+1 queries on Workshop#organisers and Event#organisers
when rendering the events list. Also removed unused eager loading on
Meeting (venue, permissions) and enabled Bullet#raise in development.

@Odaeus Odaeus left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is totally sensible. 👍🏻
If performance on these pages is an issue you could also look at other options like pulling from a DB view or preemptive caching.

@mroderick

Copy link
Copy Markdown
Collaborator Author

If performance on these pages is an issue you could also look at other options like pulling from a DB view or preemptive caching.

I also created #2666, which improves performance considerably.

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.

2 participants