Defect #17700

Excessive DB querying when Allow Group Issue Assignment is enabled

Added by Basile Vorontsov about 3 years ago. Updated over 2 years ago.

Status:NewStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Performance
Target version:-
Resolution: Affected version:2.5.2

Description

For every issue Redmine runs a separate query to get the roles for every member of the project, but only when Allow Group Issue Assignment is enabled.

In app/models/project.rb:
33: has_many :member_principals, :class_name => 'Member',
34: :include => :principal,
35: :conditions => "#{Principal.table_name}.type='Group' OR (#{Principal.table_name}.type='User' AND #{Principal.table_name}.status=#{Principal::STATUS_ACTIVE})"

changing line 34 to read:
:include => [:principal, :roles],

definitely solves the performance issue, but are there any pitfalls in fixing it that way?


Related issues

Related to Redmine - Defect #14906: Excessive queries on roles table when show a Issue Resolved

History

#1 Updated by Jan Niggemann (redmine.org team member) about 3 years ago

  • Related to Defect #14906: Excessive queries on roles table when show a Issue added

#2 Updated by Javi Ferrer over 2 years ago

This problem also occurs when you have a custom field with user format.

Also available in: Atom PDF