Bug #18843

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

Added by Shimon Shtein 4 months ago. Updated 3 months ago.

Status:Closed
Priority:Normal
Assigned To:Shimon Shtein
Category:Database
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

Description

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 3 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.

History

#1 Updated by Dominic Cleal 4 months ago

  • Category set to Database

#2 Updated by The Foreman Bot 4 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 3 months ago

  • Target version set to Team Ivan Iteration 12

#4 Updated by Shimon Shtein 3 months ago

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

#5 Updated by Dominic Cleal 3 months ago

  • Release set to 1.14.3

Also available in: Atom PDF