Actions
Feature #35324
closedPreload principal and roles in members#index
Feature #35324:
Preload principal and roles in members#index
Description
Hi,
MembersController#index should preload the principal and roles of the members.
When this data is not preloaded, iterating over the @members array in app/views/members/index.api.rsb causes a lot of database queries.
A patch is attached.
Thanks,
Thomas
Files
Updated by Go MAEDA over 5 years ago
- Target version set to Candidate for next major release
I have confirmed the issue. Before applying the patch, three SQL statements like the following are executed for each member.
Principal Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT ? [["id", 9], ["LIMIT", 1]]
MemberRole Load (0.5ms) SELECT "member_roles".* FROM "member_roles" WHERE "member_roles"."member_id" = ? [["member_id", 15]]
CACHE Role Load (0.0ms) SELECT "roles".* FROM "roles" WHERE "roles"."id" = ? LIMIT ? [["id", 2], ["LIMIT", 1]]
Before:
After:
Updated by Go MAEDA over 5 years ago
- Target version changed from Candidate for next major release to 5.0.0
Setting the target version to 5.0.0.
Updated by Go MAEDA over 5 years ago
- Status changed from New to Closed
- Assignee set to Go MAEDA
Committed the patch. Thank you for your contribution.
Updated by Go MAEDA over 4 years ago
- Tracker changed from Patch to Feature
Actions