Project

General

Profile

Actions

Bug #11791

closed

N+1 query on hosts#index retrieving puppet_proxy

Added by Dominic Cleal over 9 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Low
Assignee:
Category:
Performance
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

Since #11704, the hosts#index page is generating an N+1 query warning on the host puppet_proxy attribute.

 | http://0.0.0.0:3000/hosts
 | N+1 Query detected
 |   Host::Managed => [:puppet_proxy]
 |   Add to your finder: :includes => [:puppet_proxy]
 | N+1 Query method call stack
 |   /home/dcleal/code/foreman/foreman/app/models/host_status/configuration_status.rb:37:in `to_global'
 |   /home/dcleal/code/foreman/foreman/app/models/host_status/global.rb:10:in `block in build'
 |   /home/dcleal/code/foreman/foreman/app/models/host_status/global.rb:10:in `map'
 |   /home/dcleal/code/foreman/foreman/app/models/host_status/global.rb:10:in `build'
 |   /home/dcleal/code/foreman/foreman/app/models/host/managed.rb:889:in `build_global_status'
 |   /home/dcleal/code/foreman/foreman/app/helpers/hosts_helper.rb:94:in `host_global_status_icon_class_for_host'
 |   /home/dcleal/code/foreman/foreman/app/helpers/hosts_helper.rb:83:in `name_column'
 |   /home/dcleal/code/foreman/foreman/app/views/hosts/_list.html.erb:22:in `block in _app_views_hosts__list_html_erb___275981041170289430_92907540'
 |   /home/dcleal/code/foreman/foreman/app/views/hosts/_list.html.erb:17:in `_app_views_hosts__list_html_erb___275981041170289430_92907540'
 |   /home/dcleal/code/foreman/foreman/app/views/hosts/index.html.erb:4:in `_app_views_hosts_index_html_erb___1661929246903238241_92718560'

It probably doesn't even need to check for puppet_proxy itself, but just checking the presence of an ID may be enough.


Related issues 1 (0 open1 closed)

Related to Foreman - Bug #11704: Configuration no report appears as "green" iconClosedMarek Hulán09/06/2015Actions
Actions

Also available in: Atom PDF