Project

General

Profile

Actions

Refactor #2003

closed

improve pararmetize classes params retrivial speed

Added by Ohad Levy over 11 years ago. Updated over 11 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
External Nodes
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

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

Related to Foreman - Bug #2011: Param Class optimization fails on PostgesClosedOhad Levy12/05/2012Actions
Actions #1

Updated by Ohad Levy over 11 years ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100
Actions

Also available in: Atom PDF