stable
Clone or download
request #12471 Add missing index on ugroup_user
How to test: Table ugroup_user should have the missing index On request: SELECT ug.* FROM ugroup_user AS ug_u INNER JOIN user USING (user_id) INNER JOIN ugroup AS ug USING (ugroup_id) INNER JOIN groups AS g USING (group_id) LEFT JOIN user_group USING (group_id, user_id) INNER JOIN forgeconfig ON (forgeconfig.name = 'access_mode') WHERE ug_u.user_id = '10430' AND ( ( forgeconfig.value = 'restricted' AND ( user_group.group_id IS NOT NULL OR user.status = 'A' AND g.access IN ('public', 'unrestricted') OR user.status = 'R' AND g.access = 'unrestricted' ) ) OR ( forgeconfig.value <> 'restricted'AND ( user_group.group_id IS NOT NULL OR g.access <> ('private') ) ) ); With this index we improve search from: | Handler_read_key | 20145 | | Handler_read_next | 20142 | to: | Handler_read_key | 6 | | Handler_read_next | 2 | Change-Id: If6e5c538b713f33bf0fa8a8dbae3ce4aec36822a
Modified Files
Name | ||||
---|---|---|---|---|
M | src/db/mysql/database_structure.sql | +2 | −1 | Go to diff View file |
A | src/db/mysql/updates/2018/201810301339_add_ugroup_user_index.php | +37 | −0 | Go to diff View file |