Actions
Bug #7009
closedN+1 hosts query in dashboard page
Difficulty:
trivial
Triaged:
Pull request:
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)
Actions