moodle/admin/roles
Tim Hunt 482ca72089 MDL-47426 assign local roles: rewrite query for better performance.
This is an extremely dangerous query, because it includes the user
table twice, along-side two other potentially large tables,
role_assignments and user_enrolments.

The solution is to rewrite the query so that:

1. The subquery is JOINed, not WHERE ... INed. Typically query
   optimisers handle the JOIN case better.

2. Before the join was role-assignments <-> users <-> subquery.
   That is, everything was linked to u.id.

   Now the linking is role-assignments <-> subquery <-> users,
   so the SELECT DISTINT eu1_u.id FROM {enrolled users} is central.
   That seems to send a strong hint to the query optimiser about
   a good order to execute the query.
2014-10-02 17:10:40 +01:00
..
classes MDL-47426 assign local roles: rewrite query for better performance. 2014-10-02 17:10:40 +01:00
tests MDL-17081 store also CAP_INHERIT in role export files 2013-06-25 00:24:55 +02:00
admins.php MDL-40337 use full frankenstyle in get_string() calls 2013-06-27 22:17:46 +02:00
allow.php MDL-40044 Roles: Added role_allow_*_updated events to replace add_to_log on role allow page 2013-08-09 17:59:54 +08:00
assign.php MDL-44323 admin: use correct css class for warning 2014-05-15 12:00:11 +08:00
check.php MDL-41811 simplify the admin tree detection logic and fix navigation in multiple areas 2013-10-21 14:17:55 +08:00
define.php MDL-42560 Events: Removed use of role->name 2013-10-28 11:06:47 +08:00
lib.php MDL-40337 fix some more deprecated calls in role code 2013-06-27 22:41:14 +02:00
manage.php MDL-45623: Fix assigned users count on role delete confirmation page 2014-05-20 10:01:00 +12:00
managetabs.php MDL-40337 cleanup role manage UI 2013-06-27 22:17:45 +02:00
module.js MDL-45596 roles: Escape filter value before using it in form field 2014-07-04 11:49:11 +08:00
override.php MDL-45833 event: Removing courseid as the context is higher than course context 2014-06-27 11:25:14 +08:00
permissions.php MDL-41811 simplify the admin tree detection logic and fix navigation in multiple areas 2013-10-21 14:17:55 +08:00
role_schema.xml MDL-17081 fix invalid role XML schema 2013-06-25 10:18:22 +02:00
usersroles.php MDL-41811 simplify the admin tree detection logic and fix navigation in multiple areas 2013-10-21 14:17:55 +08:00