Project

General

Profile

Bug #3265

Three near-identical SQL lookups made on host show page

Added by Dominic Cleal over 9 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Database
Target version:
-
Difficulty:
Triaged:
No
Bugzilla link:
Pull request:
Fixed in Releases:
Found in Releases:
Red Hat JIRA:

Description

I see three queries to pull back reports on host show, which are all doing h.reports.recent(7):

Report Load (0.2ms)  SELECT status FROM "reports" WHERE "reports"."host_id" = 65 AND (reported_at > '2013-10-08 12:30:38.672887') ORDER BY reported_at
Report Load (0.2ms) SELECT "reports".* FROM "reports" WHERE "reports"."host_id" = 65 AND (reported_at > '2013-10-08 12:30:40.239651') ORDER BY reported_at
Report Load (0.2ms) SELECT "reports".* FROM "reports" WHERE "reports"."host_id" = 65 AND (reported_at > '2013-10-08 12:30:40.242262') ORDER BY reported_at

Clearly reports must be one of the slower parts of the page, so could we cache this lookup somewhere? Even the database or AR query cache won't help here, since the reported_at timestamp is slightly different since it's based off of the current timestamp at each of the three calls. Three separate hosts_helper methods use the same query: reports_show, runtime_chart, resources_chart.


Related issues

Related to Foreman - Bug #3243: Slow SQL queries on host show pageClosed2013-10-14

History

#1 Updated by Dominic Cleal over 9 years ago

  • Related to Bug #3243: Slow SQL queries on host show page added

Also available in: Atom PDF