Refactor #2003
improve pararmetize classes params retrivial speed
Description
Currently, when foreman search for a given parameter value, it would find the smart variable possible order and generate a few queries based on each matcher, for example:
SELECT "lookup_values".* FROM "lookup_values" WHERE "lookup_values"."match" = 'fqdn=host.example.com' AND ("lookup_values".lookup_key_id = 270) LIMIT 1 SELECT "lookup_values".* FROM "lookup_values" WHERE "lookup_values"."match" = 'domain=example.com' AND ("lookup_values".lookup_key_id = 270) LIMIT 1 SELECT "lookup_values".* FROM "lookup_values" WHERE "lookup_values"."match" = 'os=redhat 6.2' AND ("lookup_values".lookup_key_id = 270) LIMIT 1 . . .
since this happens for every parameter, this could eventually slow the system down.
an alternative approch would be to query to all possible values in one go, for example
LookupValue Load (0.2ms) SELECT "lookup_values".* FROM "lookup_values" WHERE "lookup_values"."match" = 'domain=example.com' AND "lookup_values"."lookup_key_id" IN (376, 270, 377, 275, 261)
Related issues
Associated revisions
fixes #2003 - Improve Parameterized classes values retrieval time
This patch adds a new classification class which
tries to fetch all values at once
The initial implementation cared about a name / value at a time
however getting all at once (e.g. during a puppet ENC call) is much more
common.
This patch creates in memory tree of all possible values and process
them in memory instead of asking the database for each possible match.
History
#1
Updated by Ohad Levy over 9 years ago
- Status changed from New to Closed
- % Done changed from 0 to 100
Applied in changeset e76ac9ca4690f34791d726ccac41373e43616df6.
SQL improvments for paramaters in host edit section refs #2003