Details
-
Bug
-
Status: Closed
-
Critical
-
Resolution: Duplicate
-
2.1.2
-
None
-
Any
-
MOODLE_21_STABLE
-
MDL-29831-master -
Moderate
-
Description
On a page with multiple copies of the editor (e.g. when adding a new multichoice question), an excessive number of database reads are seen.
When the editor is inserted into a page, lib/form/editor.php::MoodleQuickForm_editor->toHtml() is called
This in turn calls initialise_filepicker once for each type of media plugin - e.g. advimage, moodlemedia, and advlink
The initialise_filepicker() function in turn calls repository::get_instances which generates a set of queries for each of the repository plugins.
As an example on my default 2.1 install:
First editor: 57 queries
|
Subsequent editors: 54 queries each
|
Total queries for 17 editors = 57 + (54 * 16) = 921
|
Enabling an additional repository plugin (URL downloader) changes these numbers
First editor: 69 queries
|
Subsequent editors: 66 queries each
|
Total queries for 17 editors = 69 + (66 * 16) = 1125
|
(Note, I loaded the page twice after adding enabling additional repository plugins)
We should see if it's possible to cache the results for some of these queries. They're mostly of the nature:
SELECT * FROM mdl_repository_instances WHERE id = $1 [array ( 0 => '1', )]
|
SELECT * FROM mdl_repository_instance_config WHERE instanceid = $1 [array ( 0 => '1', )]
|
SELECT * FROM mdl_repository WHERE id = $1 [array ( 0 => '1', )]
|
SELECT name,value FROM mdl_config_plugins WHERE plugin = $1 [array ( 0 => 'local', )]
|
This is seen for any user (not just administrators). The question component is not at fault, but provides a handy set of editors to try.