Bug #18843

Change eager_load to includes statement in hosts api controller's index action

Added by Shimon Shtein 5 months ago. Updated 5 months ago.

Assigned To:Shimon Shtein
Target version:Team Ivan Iteration 12
Difficulty: Bugzilla link:
Found in release: Pull request:https://github.com/theforeman/foreman/pull/4365
Story points-
Velocity based estimate-
Release1.14.3Release relationshipAuto


Since the query is pretty wide (contains multiple joins) the execution plan will try to make all joins and only then try to filter unnecessary rows. This causes PG to load a huge temporary table into memory, and since it's too big to fit in, the CPU sky rockets.

Associated revisions

Revision a60d71e6
Added by Shimon Shtein 5 months ago

Fixes #18843 - Changed from eager_load to includes in #index

Avoiding multiple joins that result in very wide result rows.
It leads to big memory footprint in the DB especially on big datasets.
This big footprint translates then into DB high CPU usage while
processing the query.


#1 Updated by Dominic Cleal 5 months ago

  • Category set to Database

#2 Updated by The Foreman Bot 5 months ago

  • Status changed from New to Ready For Testing
  • Assigned To set to Shimon Shtein
  • Pull request https://github.com/theforeman/foreman/pull/4365 added

#3 Updated by Ivan Necas 5 months ago

  • Target version set to Team Ivan Iteration 12

#4 Updated by Shimon Shtein 5 months ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

#5 Updated by Dominic Cleal 5 months ago

  • Release set to 1.14.3

Also available in: Atom PDF