https://www.redmine.org/https://www.redmine.org/favicon.ico?16793021292012-09-13T09:20:19ZRedmineRedmine - Patch #11827: Avoid retrieving memberships for projects jump boxhttps://www.redmine.org/issues/11827?journal_id=408692012-09-13T09:20:19ZEtienne Massip
<ul></ul><p>Rails does a select count() on <code>#any?</code> instead of a select top 1?</p> Redmine - Patch #11827: Avoid retrieving memberships for projects jump boxhttps://www.redmine.org/issues/11827?journal_id=408712012-09-13T09:48:20ZEtienne Massip
<ul></ul><p>Actually this has been fixed in Rails master but not merged in 3.2 branch.</p>
<p>See <a class="external" href="https://github.com/rails/rails/issues/3179">https://github.com/rails/rails/issues/3179</a>.</p> Redmine - Patch #11827: Avoid retrieving memberships for projects jump boxhttps://www.redmine.org/issues/11827?journal_id=408832012-09-13T19:14:22ZJean-Philippe Langjp_lang@yahoo.fr
<ul></ul><p>As discussed earlier today, memberships is already loaded by <code>User#allowed_to?</code> for non admin users. So this change improves response time for admin users but adds an extra query for non admin users.</p>
<p>Would be worth doing the change after doing some optimization in <code>User#roles_for_project</code> (eg. loading only the roles for the requested project).</p> Redmine - Patch #11827: Avoid retrieving memberships for projects jump boxhttps://www.redmine.org/issues/11827?journal_id=461362013-02-27T00:17:59ZJean-Baptiste Barth
<ul><li><strong>Status</strong> changed from <i>New</i> to <i>Closed</i></li><li><strong>Assignee</strong> set to <i>Jean-Baptiste Barth</i></li></ul><p>I close this one as I think Jean-Philippe's argument is good, it might decrease performance for non admin users on small instances. I opened <a class="issue tracker-3 status-5 priority-4 priority-default closed" title="Patch: Performance: avoid querying all memberships in User#roles_for_project (Closed)" href="https://www.redmine.org/issues/13301">#13301</a> for a first step in optimizing <code>User#roles_for_project</code>.</p>
<p>Fyi, computing the project jump box was definitely taking too much time for my instance at work when the average staff user has 150+ projects. So I ended up caching this in a plugin and it works pretty well. The cache key used to cache this depends on various parameters, so as usual it won't be optimal for little installations (adding extra queries) or big installations with few projects but a lot of users. But it will save a lot of time in instances with a lot of people on a lot of projects. No general rule here, so no need to pollute the core with that.</p> Redmine - Patch #11827: Avoid retrieving memberships for projects jump boxhttps://www.redmine.org/issues/11827?journal_id=461482013-02-27T10:05:19ZEtienne Massip
<ul></ul><p>Switching to some AJAX-powered autocomplete input field rather than a simple combobox when the amount of items reaches a specific threshold (e.g. 20 items) could be a solution too.</p>