Project

General

Profile

Actions

Feature #35324

closed

Preload principal and roles in members#index

Added by Thomas Löber over 2 years ago. Updated over 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Performance
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:

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

members_index_preload.diff (741 Bytes) members_index_preload.diff Thomas Löber, 2021-05-28 12:27
Actions #1

Updated by Go MAEDA over 2 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:

Show

After:

Show

Actions #2

Updated by Go MAEDA over 2 years ago

  • Target version changed from Candidate for next major release to 5.0.0

Setting the target version to 5.0.0.

Actions #3

Updated by Go MAEDA about 2 years ago

  • Status changed from New to Closed
  • Assignee set to Go MAEDA

Committed the patch. Thank you for your contribution.

Actions #4

Updated by Go MAEDA over 1 year ago

  • Tracker changed from Patch to Feature
Actions

Also available in: Atom PDF