Project

General

Profile

Refactor #1955

improve host deletion speed

Added by Ohad Levy almost 10 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Difficulty:
Triaged:
No
Bugzilla link:
Pull request:
Fixed in Releases:
Found in Releases:

Description

Currently both facts and reports (and their log join) are deleted using dependent => :destroy

this costs a lot of time because:
  1. each value is deleted in a single SQL
  2. each AR object is initiated.

possible solutions:

  • use dependent => :destroy_all which would fix 2
  • use delete_all to delete all id's in a single query (one for facts, one for reports and another for logs).

since we are not doing any auditing on facts currently, it might be save enough to use delete_all (and remove about 70% of the time it takes to delete a host).


Related issues

Related to Foreman - Bug #8316: Removing a long-standing host creates huge transactionClosed2014-11-07

History

#1 Updated by Daniel Lobato Garcia almost 8 years ago

  • Related to Bug #8316: Removing a long-standing host creates huge transaction added

Also available in: Atom PDF