Bug #11837
closed
Serching for "facts.blah" in discovery takes a long time
Added by Alex Balk about 9 years ago.
Updated almost 9 years ago.
Category:
Discovery plugin
|
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
- 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.
- Related to Bug #9023: Provide a way to add own fact to the discovered list of hosts added
Appears to have been added in #9023, without any optimisation.
- Related to Bug #11884: Turbolinks load some pages twice added
- Status changed from New to Ready For Testing
- Pull request https://github.com/theforeman/foreman_discovery/pull/219 added
- Pull request deleted (
)
- Assignee set to Lukas Zapletal
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
Also available in: Atom
PDF