Patch #16905
closed
Count users with a single query on group list
Added by Jérôme BATAILLE over 10 years ago.
Updated over 7 years ago.
Category:
Code cleanup/refactoring
Description
All users are loaded for each group, only to count them !
Files
- Subject changed from Admin : groups otpimization of users count to Count users with a single query on group list
- Category changed from Groups to Code cleanup/refactoring
- Status changed from New to Resolved
- Assignee set to Jean-Philippe Lang
- Target version set to 2.6.0
This patch didn't work for me, as the hash keys are strings (tested with postgresql):
irb(main):001:0> User.joins(:groups).group('group_id').count
=> {"98913"=>2}
Fix committed in r13149 with test.
Jean-Philippe, thanks to have reviewed this patch.
- Status changed from Resolved to Closed
Hi, you can indicate in the Resolution that's it's Fixed, if you have the time to, thanks a lot.
Jérôme BATAILLE wrote:
Hi, you can indicate in the Resolution that's it's Fixed, if you have the time to, thanks a lot.
"patch" tracker does not have "resolution" filed.
Also available in: Atom
PDF