Actions
Bug #3265
openThree near-identical SQL lookups made on host show page
Status:
New
Priority:
Normal
Assignee:
-
Category:
Database
Target version:
-
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.
Updated by Dominic Cleal almost 11 years ago
- Related to Bug #3243: Slow SQL queries on host show page added
Actions