Project

General

Profile

Patch #26122

Updated by Mischa The Evil over 7 years ago

The the change from #21608 
 http://www.redmine.org/issues/21608 
 should be reverted because it's a speed regression: regression 

 1/ current version 
 <pre>EXISTS EXISTS (SELECT 1 AS one FROM enabled_modules em WHERE em.project_id = projects.id AND em. NAME = 'issue_tracking')</pre> 'issue_tracking') 

 2/ previous version (actually (actualy faster even without an index on enabled modules) 
 <pre>projects.id projects.id IN (SELECT project_id FROM enabled_modules em WHERE em.project_id = projects.id AND em. NAME = 'issue_tracking'</pre> 'issue_tracking' 

 3/ fastest version (in some cases better indexes were used) 
 <pre>INNER INNER JOIN `enabled_modules` ON `enabled_modules`.`project_id` = `projects`.`id` WHERE `enabled_modules`.`name` = 'issue_tracking'</pre> 'issue_tracking' 
 or 
 <pre>INNER INNER JOIN `enabled_modules` ON `enabled_modules`.`project_id` = `projects`.`id` AND `enabled_modules`.`name` = 'issue_tracking'</pre> 'issue_tracking' 

 Patches: patches 
 * revert of #21608, because the previous version was faster (about 30%) 
 * new index "enabled_modules_name", but it's not very helpful unless you have many projects (3000+) 
 * implementation of visible conditions with inner join instead of subselect, it passes all tests, but it should be refactored. I want to know what do you think about it first 

 <pre> 
 Rails version               4.2.8 
 Ruby version                2.1.9-p490 (x64-mingw32) 
 RubyGems version            2.6.12 
 Rack version                1.6.8 
 Middleware                  Rack::Sendfile, Rack::ContentLength, ActionDispatch::Static, Rack::Lock, #<ActiveSupport::Cache::Strategy::LocalCache::Middleware:0x00000007745610>, Rack::Runtime, Rack::MethodOverride, ActionDispatch::RequestId, Rails::Rack::Logger, ActionDispatch::ShowExceptions, ActionDispatch::DebugExceptions, ActionDispatch::RemoteIp, ActionDispatch::Reloader, ActionDispatch::Callbacks, ActiveRecord::ConnectionAdapters::ConnectionManagement, ActiveRecord::QueryCache, ActionDispatch::Cookies, ActionDispatch::Session::CookieStore, ActionDispatch::Flash, ActionDispatch::ParamsParser, ActionDispatch::XmlParamsParser, Rack::Head, Rack::ConditionalGet, Rack::ETag, RequestStore::Middleware, OpenIdAuthentication 
 Environment                 development 
 Database adapter            mysql2 
 Database schema version     20170607051650 
 </pre>

Back