Patch #22850

Speedup remove_inherited_roles

Added by Pavel Rosický about 1 year ago. Updated 10 months ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Jean-Philippe Lang% Done:

0%

Category:Performance
Target version:3.4.0

Description

Environment:
  Redmine version                3.2.2.devel
  Ruby version                   2.1.5-p273 (2014-11-13) [x64-mingw32]
  Rails version                  4.2.6
  Environment                    production
  Database adapter               Mysql2
SCM:
  Git                            2.8.1
  Filesystem
Redmine plugins:
  no plugin installed

I made an optimalization to avoid these queries, that reliably kills the application if there are many member roles.

SELECT `member_roles`.* FROM `member_roles` WHERE `member_roles`.`inherited_from` = ?

This table was retrieved with a full table scan, which is often quite bad for performance, unless you only retrieve a few rows.
The table was retrieved with this index:
No index was used in this part of the query.
You can speed up this query by querying only fields that are within the index. Or you can create an index that includes every field in your query, including the primary key.
Approximately 1224500 rows of this table were scanned.

patches.patch Magnifier (1.54 KB) Pavel Rosický, 2016-05-19 10:18

patches.patch Magnifier (1.54 KB) Pavel Rosický, 2016-05-25 18:19

patches.patch Magnifier - speedup patch (1.54 KB) Pavel Rosický, 2016-05-25 18:21

patches20160525.patch Magnifier - speedup patch (1.49 KB) Pavel Rosický, 2016-05-25 18:23


Related issues

Related to Redmine - Defect #19179: Very slow performance on editing issues when projects hav... New

Associated revisions

Revision 15883
Added by Jean-Philippe Lang 10 months ago

Speedup remove_inherited_roles (#22850).

Patch by Pavel Rosický.

History

#1 Updated by Pavel Rosický about 1 year ago

#2 Updated by Pavel Rosický about 1 year ago

#4 Updated by Toshi MARUYAMA about 1 year ago

  • Related to Defect #19179: Very slow performance on editing issues when projects have inherit members checked added

#5 Updated by Toshi MARUYAMA about 1 year ago

  • Description updated (diff)

#6 Updated by Toshi MARUYAMA about 1 year ago

  • Target version set to 3.4.0

LGTM.

#7 Updated by Jean-Philippe Lang 10 months ago

  • Status changed from New to Closed
  • Assignee set to Jean-Philippe Lang

Patch committed, thanks.

Also available in: Atom PDF