Bug #7009

N+1 hosts query in dashboard page

Added by Ohad Levy over 3 years ago. Updated over 3 years ago.

Status:Closed
Priority:Normal
Assigned To:Ohad Levy
Category:Web Interface
Target version:Sprint 27
Difficulty:trivial Bugzilla link:
Found in release:nightly Pull request:https://github.com/theforeman/foreman/pull/1670
Story points-
Velocity based estimate-
Release1.6.0Release relationshipAuto

Description

when browsing the dashboard page, the following was observed in the logs:

  Report Load (11.1ms)  SELECT "reports".* FROM "reports" WHERE (status <> 0) AND (("reports"."reported_at" >= '2014-08-04')) ORDER BY "reports"."reported_at" DESC NULLS LAST LIMIT 6
  Host::Managed Load (0.4ms)  SELECT "hosts".* FROM "hosts" WHERE "hosts"."type" IN ('Host::Managed') AND "hosts"."id" = 13 LIMIT 1
  Host::Managed Load (0.4ms)  SELECT "hosts".* FROM "hosts" WHERE "hosts"."type" IN ('Host::Managed') AND "hosts"."id" = 20 LIMIT 1
  Host::Managed Load (0.4ms)  SELECT "hosts".* FROM "hosts" WHERE "hosts"."type" IN ('Host::Managed') AND "hosts"."id" = 27 LIMIT 1
  Host::Managed Load (0.7ms)  SELECT "hosts".* FROM "hosts" WHERE "hosts"."type" IN ('Host::Managed') AND "hosts"."id" = 29 LIMIT 1
  Host::Managed Load (0.3ms)  SELECT "hosts".* FROM "hosts" WHERE "hosts"."type" IN ('Host::Managed') AND "hosts"."id" = 35 LIMIT 1
  Host::Managed Load (0.3ms)  SELECT "hosts".* FROM "hosts" WHERE "hosts"."type" IN ('Host::Managed') AND "hosts"."id" = 6 LIMIT 1
...
  Rendered dashboard/_reports_widget.html.erb (143.1ms)


Related issues

Related to Foreman - Bug #5841: Foreman dashboard slow in 1.5 for non admin users Closed 05/20/2014

Associated revisions

Revision 9f1c910a
Added by Ohad Levy over 3 years ago

fixes #7009, N+1 (actually 6+1) queries in dashboard page

Revision 1dbf336f
Added by Ohad Levy over 3 years ago

fixes #7009, N+1 (actually 6+1) queries in dashboard page

(cherry picked from commit 9f1c910aecc2436da757f33380a38cf6cc3744e7)

History

#1 Updated by The Foreman Bot over 3 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/1670 added

#2 Updated by Dominic Cleal over 3 years ago

  • Related to Bug #5841: Foreman dashboard slow in 1.5 for non admin users added

#3 Updated by Dominic Cleal over 3 years ago

  • Release set to 1.6.0

#4 Updated by Ohad Levy over 3 years ago

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

Also available in: Atom PDF