Project

General

Profile

Actions

Patch #29171

closed

Add an index to improve the performance of issue queries involving custom fields

Added by Stephane Evr almost 6 years ago. Updated 7 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Performance
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:

Description

On our Redmine installation, we have around 100000+ issues with lots of custom fields.
I ran into a bottleneck were some Issue Queries where very very slow when requesting criteria on multiple custom fields and grouping.

In the custom_values table, I noticed that there was no index for [customized_type, customized_id, custom_field_id]. Adding such index resulted in loading times much faster for those complex issue queries (From 60+ seconds down to 5 seconds, with DB caching disabled).

Here is the index I added:

class AddMissingIndexCustomValues < ActiveRecord::Migration
  def change
    add_index :custom_values, [:customized_type, :customized_id, :custom_field_id], name: "custom_values_customized_custom_field" 
  end
end

Files

29171.patch (696 Bytes) 29171.patch Go MAEDA, 2022-10-12 16:38
Actions

Also available in: Atom PDF