pinballmap / pbm

Pinball Map
https://pinballmap.com
GNU General Public License v3.0
110 stars 25 forks source link

Current N+1s #1510

Closed RyanTG closed 1 year ago

RyanTG commented 1 year ago

When you visit machine_score_xrefs.rss

user: rgratzer GET /la/machine_score_xrefs.rss USE eager loading detected LocationMachineXref => [:machine] Add to your query: .includes([:machine]) Call stack /home/rgratzer/Documents/pinball/pbm/app/views/machine_score_xrefs/index.rss.builder:9:in block (3 levels) in _app_views_machine_score_xrefs_index_rss_builder__1525976165197441753_109680' /home/rgratzer/Documents/pinball/pbm/app/views/machine_score_xrefs/index.rss.builder:8:inblock (2 levels) in _app_views_machine_score_xrefs_index_rss_builder1525976165197441753_109680' /home/rgratzer/Documents/pinball/pbm/app/views/machine_score_xrefs/index.rss.builder:3:in block in _app_views_machine_score_xrefs_index_rss_builder__1525976165197441753_109680' /home/rgratzer/Documents/pinball/pbm/app/views/machine_score_xrefs/index.rss.builder:2:in_app_views_machine_score_xrefs_index_rss_builder1525976165197441753_109680' /home/rgratzer/Documents/pinball/pbm/app/controllers/machine_score_xrefs_controller.rb:28:in `index'

user: rgratzer GET /la/machine_score_xrefs.rss USE eager loading detected LocationMachineXref => [:location] Add to your query: .includes([:location]) Call stack /home/rgratzer/Documents/pinball/pbm/app/views/machine_score_xrefs/index.rss.builder:10:in block (3 levels) in _app_views_machine_score_xrefs_index_rss_builder__1525976165197441753_109680' /home/rgratzer/Documents/pinball/pbm/app/views/machine_score_xrefs/index.rss.builder:8:inblock (2 levels) in _app_views_machine_score_xrefs_index_rss_builder1525976165197441753_109680' /home/rgratzer/Documents/pinball/pbm/app/views/machine_score_xrefs/index.rss.builder:3:in block in _app_views_machine_score_xrefs_index_rss_builder__1525976165197441753_109680' /home/rgratzer/Documents/pinball/pbm/app/views/machine_score_xrefs/index.rss.builder:2:in_app_views_machine_score_xrefs_index_rss_builder1525976165197441753_109680' /home/rgratzer/Documents/pinball/pbm/app/controllers/machine_score_xrefs_controller.rb:28:in `index'

When you add a score and the score re-render:

user: rgratzer GET /locations/111267/render_scores USE eager loading detected MachineScoreXref => [:user] Add to your query: .includes([:user]) Call stack /home/rgratzer/Documents/pinball/pbm/app/views/locations/_render_scores.html.haml:4:in block in _app_views_locations__render_scores_html_haml___2182275324465513762_667160' /home/rgratzer/Documents/pinball/pbm/app/views/locations/_render_scores.html.haml:1:in_app_views_locationsrender_scores_htmlhaml2182275324465513762_667160' /home/rgratzer/Documents/pinball/pbm/app/controllers/locations_controller.rb:79:in `render_scores'

When you reload a location search

user: rgratzer GET /locations/17679/render_machines AVOID eager loading detected LocationMachineXref => [:machine_score_xrefs] Remove from your query: .includes([:machine_score_xrefs])

user: rgratzer GET /locations/17679/render_machines AVOID eager loading detected MachineScoreXref => [:user] Remove from your query: .includes([:user])

When visiting admin/location

user: rgratzer AVOID eager loading detected Location => [:zone, :location_type, :operator] Remove from your query: .includes([:zone, :location_type, :operator]) Call stack

When visiting admin/machine

user: rgratzer AVOID eager loading detected Machine => [:machine_group] Remove from your query: .includes([:machine_group]) Call stack

When visiting admin/suggested_location

user: rgratzer AVOID eager loading detected SuggestedLocation => [:operator, :zone] Remove from your query: .includes([:operator, :zone]) Call stack

When visiting a region that does not have any Operators, such as /anchorage

user: rgratzer AVOID eager loading detected Location => [:operator] Remove from your query: .includes([:operator]) Call stack

Seems like we should just hide the operator search button if there are no operators in that region.

On user_profile

~~user: rgratzer GET /users/13/profile USE eager loading detected UserFaveLocation => [:location] Add to your query: .includes([:location]) Call stack /home/rgratzer/Documents/pinball/pbm/app/views/users/profile.html.haml:92:in block in _app_views_users_profile_html_haml__4572123077242764867_111740' /home/rgratzer/Documents/pinball/pbm/app/views/users/profile.html.haml:90:in_app_views_users_profile_html_haml__4572123077242764867_111740'~~

RyanTG commented 1 year ago

Side note is that I fixed some crashing when searching on /admin/machine_score_xref and added new fields that you can filter. But now the regular search on that screen appears to do nothing.

RyanTG commented 1 year ago

Whole bunch of new N+1s in the upgraded rails_admin. At first glance they seem kind of minor, but will look deeper.