Project

General

Profile

Actions

Bug #8513

closed

N+1 query on compute resource image list

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

Status:
Closed
Priority:
Normal
Assignee:
Category:
Database
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

Seen on the compute resource view page, when loading the images tab over AJAX.

Started GET "/compute_resources/8-example/images" for 127.0.0.1 at 2014-11-26 09:27:14 +0000
Processing by ImagesController#index as HTML
  Parameters: {"compute_resource_id"=>"8-example"}
  User Load (0.2ms)  SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1  [["id", 24]]
Setting current user thread-local variable to admin
  AuthSource Load (0.2ms)  SELECT "auth_sources".* FROM "auth_sources" WHERE "auth_sources"."id" = 1 LIMIT 1
  Image Load (0.1ms)  SELECT "images".* FROM "images" LIMIT 1
  ComputeResource Load (0.1ms)  SELECT "compute_resources".* FROM "compute_resources" WHERE "compute_resources"."id" = ? ORDER BY compute_resources.name LIMIT 1  [["id", "8-example"]]
  Image Load (0.5ms)  SELECT "images".* FROM "images" WHERE "images"."compute_resource_id" = 8 LIMIT 10 OFFSET 0
  Operatingsystem Load (0.2ms)  SELECT "operatingsystems".* FROM "operatingsystems" WHERE "operatingsystems"."id" = 6 ORDER BY operatingsystems.name LIMIT 1
  CACHE (0.0ms)  SELECT "operatingsystems".* FROM "operatingsystems" WHERE "operatingsystems"."id" = 6 ORDER BY operatingsystems.name LIMIT 1
  Rendered images/index.html.erb within layouts/application (24.3ms)
  Rendered home/_user_dropdown.html.erb (1.5ms)
  Rendered home/_org_switcher.html.erb (0.0ms)
  Rendered home/_submenu.html.erb (1.7ms)
  Rendered home/_submenu.html.erb (2.4ms)
  Rendered home/_submenu.html.erb (1.7ms)
  Rendered home/_submenu.html.erb (1.6ms)
  Rendered home/_submenu.html.erb (1.9ms)
  Rendered home/_topbar.html.erb (17.1ms)
  Rendered layouts/base.html.erb (47.9ms)
Completed 200 OK in 98.5ms (Views: 75.2ms | ActiveRecord: 1.2ms)
user: dcleal
http://0.0.0.0:3000/compute_resources/8-example/images
N+1 Query detected
  Image => [:operatingsystem]
  Add to your finder: :include => [:operatingsystem]
N+1 Query method call stack
  /home/dcleal/code/foreman/foreman/app/views/images/index.html.erb:19:in `block in _app_views_images_index_html_erb___1356502804056466923_78463940'
  /home/dcleal/code/foreman/foreman/app/views/images/index.html.erb:16:in `_app_views_images_index_html_erb___1356502804056466923_78463940'
  /home/dcleal/code/foreman/foreman/app/models/concerns/foreman/thread_session.rb:33:in `clear_thread'
  /home/dcleal/code/foreman/foreman/lib/middleware/catch_json_parse_errors.rb:9:in `call'
Actions #1

Updated by Tom Caspy over 9 years ago

  • Status changed from New to Assigned
  • Assignee set to Tom Caspy
Actions #2

Updated by The Foreman Bot over 9 years ago

  • Status changed from Assigned to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/1994 added
  • Pull request deleted ()
Actions #3

Updated by Tom Caspy over 9 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100
Actions #4

Updated by Dominic Cleal over 9 years ago

  • translation missing: en.field_release set to 29
Actions

Also available in: Atom PDF