Project

General

Profile

Actions

Bug #3265

open

Three near-identical SQL lookups made on host show page

Added by Dominic Cleal about 11 years ago.

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

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 1 (0 open1 closed)

Related to Foreman - Bug #3243: Slow SQL queries on host show pageClosedOhad Levy10/14/2013Actions
Actions

Also available in: Atom PDF