- Affected version
- 2.3.13
The ACP template list query never uses the existing style_id_type_title making the page slow to load:
Suggested fix: Force the finder to use style_id_type_title
Code:
SELECT `xf_template_map`.*, `xf_template_Template_1`.*, `xf_addon_AddOn_2`.*
FROM `xf_template_map`
INNER JOIN `xf_template` AS `xf_template_Template_1` ON (`xf_template_Template_1`.`template_id` = `xf_template_map`.`template_id`)
LEFT JOIN `xf_addon` AS `xf_addon_AddOn_2` ON (`xf_addon_AddOn_2`.`addon_id` = `xf_template_Template_1`.`addon_id`)
WHERE (`xf_template_map`.`style_id` = 1) AND (`xf_template_map`.`type` = 'public')
ORDER BY CONVERT (`xf_template_map`.`title` USING utf8mb4) ASC
LIMIT 300
Run Time: 2.917213
Select Type Table Type Possible Keys Key Key Len Ref Rows Extra
SIMPLE xf_template_Template_1 ALL PRIMARY 3890 Using temporary; Using filesort
SIMPLE xf_template_map ref|filter style_id_type_title,template_id,type_title template_id|style_id_type_title 4|26 test.xf_template_Template_1.template_id 1 (47%) Using where; Using rowid filter
SIMPLE xf_addon_AddOn_2 eq_ref PRIMARY PRIMARY 52 test.xf_template_Template_1.addon_id 1
XF\Db\Mysqli\Statement->execute() in src/XF/Db/AbstractAdapter.php at line 96
XF\Db\AbstractAdapter->query() in src/XF/Mvc/Entity/Finder.php at line 1461
XF\Mvc\Entity\Finder->fetch() in src/XF/Admin/Controller/StyleController.php at line 196
XF\Admin\Controller\StyleController->actionTemplates() in src/XF/Mvc/Dispatcher.php at line 364
XF\Mvc\Dispatcher->dispatchClass() in src/XF/Mvc/Dispatcher.php at line 266
XF\Mvc\Dispatcher->dispatchFromMatch() in src/XF/Mvc/Dispatcher.php at line 121
XF\Mvc\Dispatcher->dispatchLoop() in src/XF/Mvc/Dispatcher.php at line 63
XF\Mvc\Dispatcher->run() in src/XF/App.php at line 2840
XF\App->run() in src/XF.php at line 850
XF::runApp() in admin.php at line 15
Suggested fix: Force the finder to use style_id_type_title