-
Bug
-
Resolution: Fixed
-
Minor
-
4.2
-
MOODLE_402_STABLE
-
MOODLE_402_STABLE
-
MDL-78313-blocks-performance -
Doing some testing of Moodle 4.2 we kept failing to load the admin/blocks.php page in sites with real data. works fine in clean install for some reason.
Traced it back to this query - https://github.com/moodle/moodle/blob/MOODLE_402_STABLE/admin/classes/table/block_management_table.php#L44-L56 that was implemented in MDL-75667 and moved around into a different file in MDL-76867
The query just never completes when run on the database directly.
Doing a few tests with the query, it seems the individual left joins work fine but it's when both are included in the query that things fall over.
i.e
This works fine
SELECT b.name,b.id,b.name
|
FROM mdl_block b
|
LEFT JOIN mdl_block_instances bcinst ON bcinst.blockname = b.name AND bcinst.pagetypepattern = 'course-view-*' |
GROUP BY b.id, b.name, b.visible
|
ORDER BY b.name ASC
|
and so does this
SELECT b.name,b.id,b.name
|
FROM mdl_block b
|
LEFT JOIN mdl_block_instances binst ON binst.blockname = b.name
|
GROUP BY b.id, b.name, b.visible
|
ORDER BY b.name ASC
|
but this does not
SELECT b.name,b.id,b.name
|
FROM mdl_block b
|
LEFT JOIN mdl_block_instances binst ON binst.blockname = b.name
|
LEFT JOIN mdl_block_instances bcinst ON bcinst.blockname = b.name AND bcinst.pagetypepattern = 'course-view-*' |
GROUP BY b.id, b.name, b.visible
|
ORDER BY b.name ASC
|
For reference, our site has 200 000 block instances.
This is in MySQL 8.0 on AWS RDS serverless v2 but we have also tested the query in MySQL5.7 Enterprise on traditional hardware with the same outcome.
- is a regression caused by
-
MDL-75667 Improve speed of admin/blocks.php by combining db counts
-
- Closed
-