Actions
Bug #11837
closedSerching for "facts.blah" in discovery takes a long time
Difficulty:
Triaged:
Description
Attached is the debug log of a sample query (facts.site = chidc2). It's possible that there's missing indexes in the facts table. In this case the DB is PG, but we've also tried mysql with similar results.
Files
Updated by Dominic Cleal over 9 years ago
- Project changed from Foreman to Discovery
- Category set to Discovery plugin
Looks like the initial search is actually fast, but needlessly run twice:
2015-09-15T14:16:43 [sql] [D] (163.0ms) SELECT COUNT(*) FROM "hosts" INNER JOIN "fact_values" fact_values_579987 ON (hosts.id = fact_values_579987.host_id) | INNER JOIN "fact_names" fact_names_579987 ON (fact_names_579987.id = fact_values_579987.fact_name_id) WHERE "hosts"."type" IN ('Host::Discovered') AND ((fact_names_579987."name" = 'site') AND ("hosts"."id" IN (SELECT "host_id" FROM "fact_values" WHERE "fact_values_579987"."value" = 'chidc2' ))) 2015-09-15T14:16:43 [sql] [D] CACHE (0.0ms) SELECT COUNT(*) FROM "hosts" INNER JOIN "fact_values" fact_values_579987 ON (hosts.id = fact_values_579987.host_id) | INNER JOIN "fact_names" fact_names_579987 ON (fact_names_579987.id = fact_values_579987.fact_name_id) WHERE "hosts"."type" IN ('Host::Discovered') AND ((fact_names_579987."name" = 'site') AND ("hosts"."id" IN (SELECT "host_id" FROM "fact_values" WHERE "fact_values_579987"."value" = 'chidc2' )))
The rest looks like a very inefficient rendering of the host list, where it appears to be retrieving the list of facts for every host separately by calling .facts_hash, without preloading the necessary data.
Updated by Dominic Cleal over 9 years ago
- Related to Bug #9023: Provide a way to add own fact to the discovered list of hosts added
Updated by Dominic Cleal over 9 years ago
Appears to have been added in #9023, without any optimisation.
Updated by Lukas Zapletal over 9 years ago
- Related to Bug #11884: Turbolinks load some pages twice added
Updated by The Foreman Bot over 9 years ago
- Status changed from New to Ready For Testing
- Pull request https://github.com/theforeman/foreman_discovery/pull/219 added
- Pull request deleted (
)
Updated by Anonymous almost 9 years ago
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
Applied in changeset foreman_discovery|c3b1b2cb06f8db1962b491f76c1f09e8e77fb700.
Actions