Project

General

Profile

Actions

Refactor #8798

open

Reports.expire uses an unnecessary join on logs

Added by Ori Rabin over 9 years ago. Updated over 9 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Database
Target version:
-
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

When deleting the logs the line Log.joins(:report) doesn't need the reports table:
https://github.com/theforeman/foreman/blob/d50c79908831be65da0b0005e438c9e819db613a/app/models/report.rb#L122

In mysql the join uses the index and removing it causes the query to take longer.
This needs to be checked in other dbs and refactored to use the index without the join.


Related issues 1 (0 open1 closed)

Related to Foreman - Bug #8565: report::expire is running very slowlyClosedDominic Cleal12/03/2014Actions
Actions

Also available in: Atom PDF