ソースを参照

#lock_nested_set very slow on mysql with thousands of subtasks (#23318).

Patch by Stephane Evr.

git-svn-id: http://svn.redmine.org/redmine/trunk@16053 e93f8b46-1217-0410-a6f0-8f06a7374b81
tags/3.4.0
Jean-Philippe Lang 7年前
コミット
10b3e3e323
1個のファイルの変更2行の追加1行の削除
  1. 2
    1
      lib/redmine/nested_set/issue_nested_set.rb

+ 2
- 1
lib/redmine/nested_set/issue_nested_set.rb ファイルの表示

@@ -158,7 +158,8 @@ module Redmine
self.class.reorder(:id).where(:root_id => sets_to_lock).lock(lock).ids
else
sets_to_lock = [id, parent_id].compact
self.class.reorder(:id).where("root_id IN (SELECT root_id FROM #{self.class.table_name} WHERE id IN (?))", sets_to_lock).lock.ids
inner_join_statement = self.class.select(:root_id).where(id: sets_to_lock).distinct(:root_id).to_sql
self.class.reorder(:id).joins("INNER JOIN (#{inner_join_statement}) as i2 ON #{self.class.table_name}.root_id = i2.root_id").lock.ids
end
end


読み込み中…
キャンセル
保存