-
Bug
-
Resolution: Fixed
-
Major
-
3.2.3
-
MySQL
-
MOODLE_32_STABLE
-
MOODLE_32_STABLE, MOODLE_33_STABLE
-
On our Moodle test environment the messages page is taking several minutes to open for all users.
It looks as though MDL-57370 has not fixed the issues with slowness for our installation.
I have found that queries in the \core_message\api::get_conversations() method are running really slowly for us for example running the first query for the admin takes 88 seconds and returns 8 results
SELECT
|
id, useridfrom, useridto, subject, fullmessage, fullmessageformat,
|
fullmessagehtml, smallmessage, notification, contexturl,
|
contexturlname, timecreated, timeuserfromdeleted, timeusertodeleted,
|
component, eventtype, 0 as timeread |
FROM mdl_message
|
WHERE
|
(useridto = 2 AND timeusertodeleted = 0 AND notification = 0) |
OR
|
(useridfrom = 2 AND timeuserfromdeleted = 0 AND notification = 0) |
UNION ALL
|
SELECT
|
id, useridfrom, useridto, subject, fullmessage, fullmessageformat,
|
fullmessagehtml, smallmessage, notification, contexturl,
|
contexturlname, timecreated, timeuserfromdeleted, timeusertodeleted,
|
component, eventtype, timeread
|
FROM mdl_message_read
|
WHERE
|
(useridto = 2 AND timeusertodeleted = 0 AND notification = 0) |
OR
|
(useridfrom = 2 AND timeuserfromdeleted = 0 AND notification = 0) |
The explain is:
id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
---|---|---|---|---|---|---|---|---|---|
1 | PRIMARY | mdl_message | index_merge | mdl_mess_useusetimtim_ix,mdl_mess_usetimnot_ix,mdl_mess_usetimnot2_ix | mdl_mess_usetimnot2_ix,mdl_mess_usetimnot_ix | 18,18 | NULL | 3 | Using union(mdl_mess_usetimnot2_ix,mdl_mess_usetimnot_ix); Using where |
2 | UNION | mdl_message_read | ref | mdl_messread_useusetimtim_ix,mdl_messread_nottim_ix,mdl_messread_usetimnot_ix,mdl_messread_usetimnot2_ix | mdl_messread_nottim_ix | 2 | const | 636313 | Using where |
NULL | UNION RESULT | <union1,2> | ALL | NULL | NULL | NULL | NULL | NULL | Using temporary |
We are using MySQL 5.6