-
Bug
-
Resolution: Fixed
-
Critical
-
3.2.5, 3.4
-
MySQL
-
MOODLE_32_STABLE, MOODLE_34_STABLE
-
MOODLE_32_STABLE, MOODLE_33_STABLE, MOODLE_34_STABLE
-
We recently upgraded from 3.2.4+ (Build: 20170714) to 3.2.5
After the upgrade when term started we found that Moodle was performing poorly during periods of heavier load, with the database server CPU running at maximum.
The most time consuming query was the one in block_manager::load_blocks()
We found that the only change to this query was in MDL-58744
The change made in changes the query execution plan on MySQL from:MDL-58744
id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
---|---|---|---|---|---|---|---|---|---|
1 | SIMPLE | bi | range | mdl_blocinst_parshopagsub_ix, mdl_blocinst_par_ix | mdl_blocinst_par_ix | 8 | NULL | 27 | Using index condition; Using where; Using temporary; Using filesort |
1 | SIMPLE | bp | eq_ref | mdl_blocposi_bloconpagsub_uix, mdl_blocposi_blo_ix, mdl_blocposi_con_ix | mdl_blocposi_bloconpagsub_uix | 260 | livemoodle.bi.id, const, const, const | 1 | Using where |
1 | SIMPLE | b | eq_ref | mdl_bloc_nam_uix | mdl_bloc_nam_uix | 122 | livemoodle.bi.blockname | 1 | Using where |
1 | SIMPLE | ctx | eq_ref | mdl_cont_conins_uix, mdl_cont_ins_ix | mdl_cont_conins_uix | 16 | const, livemoodle.bi.id | 1 | NULL |
to
id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
---|---|---|---|---|---|---|---|---|---|
1 | SIMPLE | bi | range | mdl_blocinst_parshopagsub_ix, mdl_blocinst_par_ix | mdl_blocinst_par_ix | 8 | NULL | 27 | Using index condition; Using where; Using temporary; Using filesort |
1 | SIMPLE | bp | ref | mdl_blocposi_bloconpagsub_uix, mdl_blocposi_blo_ix, mdl_blocposi_con_ix | mdl_blocposi_bloconpagsub_uix | 8 | livemoodle.bi.id | 1 | Using where |
1 | SIMPLE | b | eq_ref | mdl_bloc_nam_uix | mdl_bloc_nam_uix | 122 | livemoodle.bi.blockname | 1 | Using where |
1 | SIMPLE | ctx | eq_ref | mdl_cont_conins_uix, mdl_cont_ins_ix | mdl_cont_conins_uix | 16 | const, livemoodle.bi.id | 1 | NULL |
Notice that the join on the block_positions table has changed from an eq_ref (meaning a single row comparison) to a ref (will compare multiple rows)
The number of records we have in each table involved is:
tablename | records |
---|---|
mdl_block_instances | 793923 |
mdl_block | 58 |
mdl_block_positions | 285301 |
mdl_context | 3256997 |
We can see the change in database query times from the upgrade:
And after we reverted the MDL-58744 change:
- is a regression caused by
-
MDL-58744 Sticky Block region overwrite on Dashboard does not apply if $CFG->forcedefaultmymoodle is set.
- Closed