Patch #16905
Count users with a single query on group list
Status: | Closed | Start date: | ||
---|---|---|---|---|
Priority: | Normal | Due date: | ||
Assignee: | % Done: | 0% | ||
Category: | Code cleanup/refactoring | |||
Target version: | 2.6.0 |
Description
All users are loaded for each group, only to count them !
Associated revisions
Count users with a single query on group list (#16905).
History
#1
Updated by Jérôme BATAILLE almost 7 years ago
- File RM_16905_groups_index_users_count_optim.diff
added
Here is the patch
#2
Updated by Jean-Philippe Lang almost 7 years ago
- 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.
#3
Updated by Jérôme BATAILLE almost 7 years ago
Jean-Philippe, thanks to have reviewed this patch.
#4
Updated by Jean-Philippe Lang over 6 years ago
- Status changed from Resolved to Closed
#5
Updated by Jérôme BATAILLE about 4 years ago
Hi, you can indicate in the Resolution that's it's Fixed, if you have the time to, thanks a lot.
#6
Updated by Toshi MARUYAMA almost 4 years ago
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.