- Affected version
- 2.2.2
In an article forum there are two possible N+1 query patterns;
- If a thread/first post is bookmarked
- If the first post's user is permitted for trusted links.
SELECT
FROM
WHERE (
ORDER BY
LIMIT 1
Run Time: 0.000274
xf_bookmark_item
.*FROM
xf_bookmark_item
WHERE (
xf_bookmark_item
.content_type
= 'post') AND (xf_bookmark_item
.content_id
= 9169317) AND (xf_bookmark_item
.user_id
= 7)ORDER BY
xf_bookmark_item
.bookmark_date
ASCLIMIT 1
Run Time: 0.000274
Select Type | Table | Type | Possible Keys | Key | Key Len | Ref | Rows | Extra |
---|---|---|---|---|---|---|---|---|
SIMPLE | Impossible WHERE noticed after reading const tables |
- XF\Db\Mysqli\Statement->execute() in src/XF/Db/AbstractAdapter.php at line 94
- XF\Db\AbstractAdapter->query() in src/XF/Mvc/Entity/Finder.php at line 1346
- XF\Mvc\Entity\Finder->fetchOne() in src/XF/Mvc/Entity/FinderCollection.php at line 61
- XF\Mvc\Entity\FinderCollection->offsetGet() in src/XF/Mvc/Entity/FinderCollection.php at line 111
- XF\Mvc\Entity\FinderCollection->offsetExists() in src/XF/Entity/BookmarkTrait.php at line 43
- XF\Entity\Post->isBookmarked()
- call_user_func_array() in src/XF/Template/Templater.php at line 1166
- XF\Template\Templater->method() in internal_data/code_cache/templates/l1/s25/public/bookmark_macros.php at line 21
- XF\Template\Templater->{closure}() in src/XF/Template/Templater.php at line 799
- XF\Template\Templater->callMacro() in internal_data/code_cache/templates/l1/s25/public/post_macros.php at line 326
- XF\Template\Templater->{closure}() in src/XF/Template/Templater.php at line 799
- XF\Template\Templater->callMacro() in internal_data/code_cache/templates/l1/s25/public/post_article_macros.php at line 79
- XF\Template\Templater->{closure}() in src/XF/Template/Templater.php at line 799
- XF\Template\Templater->callMacro() in internal_data/code_cache/templates/l1/s25/public/forum_view_type_article.php at line 144
- XF\Template\Templater->{closure}() in src/XF/Template/Templater.php at line 799
- XF\Template\Templater->callMacro() in internal_data/code_cache/templates/l1/s25/public/forum_view_type_article.php at line 54
- XF\Template\Templater->{closure}() in src/XF/Template/Templater.php at line 962
- XF\Template\Templater->renderExtensionInternal() in src/XF/Template/Templater.php at line 898
- XF\Template\Templater->renderExtension() in internal_data/code_cache/templates/l1/s25/public/forum_view.php at line 641
- XF\Template\Templater->{closure}() in src/XF/Template/Templater.php at line 1626
- XF\Template\Templater->renderTemplate() in src/XF/Template/Templater.php at line 1617
- XF\Template\Templater->renderTemplate() in src/XF/Template/Template.php at line 24
- XF\Template\Template->render() in src/XF/Mvc/Renderer/Html.php at line 48
- XF\Mvc\Renderer\Html->renderView() in src/XF/Mvc/Dispatcher.php at line 458
- XF\Mvc\Dispatcher->renderView() in src/XF/Mvc/Dispatcher.php at line 440
- XF\Mvc\Dispatcher->renderReply() in src/XF/Mvc/Dispatcher.php at line 400
- XF\Mvc\Dispatcher->render() in src/XF/Mvc/Dispatcher.php at line 58
- XF\Mvc\Dispatcher->run() in src/XF/App.php at line 2300
- XF\App->run() in src/XF.php at line 488
- XF::runApp() in index.php at line 20
SELECT cache_value
FROM xf_permission_combination
WHERE permission_combination_id = ?
Params: 1787
Run Time: 0.000210
FROM xf_permission_combination
WHERE permission_combination_id = ?
Params: 1787
Run Time: 0.000210
Select Type | Table | Type | Possible Keys | Key | Key Len | Ref | Rows | Extra |
---|---|---|---|---|---|---|---|---|
SIMPLE | xf_permission_combination | const | PRIMARY | PRIMARY | 4 | const | 1 |
- XF\Db\Mysqli\Statement->execute() in src/XF/Db/AbstractAdapter.php at line 94
- XF\Db\AbstractAdapter->query() in src/XF/Db/AbstractAdapter.php at line 150
- XF\Db\AbstractAdapter->fetchOne() in src/XF/PermissionCache.php at line 32
- XF\PermissionCache->getGlobalPerms() in src/XF/PermissionSet.php at line 35
- XF\PermissionSet->hasGlobalPermission() in src/XF/Entity/User.php at line 1176
- XF\Entity\User->hasPermission() in src/XF/Entity/User.php at line 255
- XF\Entity\User->isLinkTrusted() in src/XF/BbCode/Renderer/Html.php at line 240
- XF\BbCode\Renderer\Html->setupRenderOptions() in src/XF/BbCode/Traverser.php at line 34
- XF\BbCode\Traverser->renderAst() in src/XF/BbCode/Traverser.php at line 20
- XF\BbCode\Traverser->render() in src/XF/SubContainer/BbCode.php at line 220
- XF\SubContainer\BbCode->render() in src/XF/Template/Templater.php at line 2343
- XF\Template\Templater->fnBbCode() in src/XF/Template/Templater.php at line 2358
- XF\Template\Templater->fnBbCodeSnippet()
- call_user_func_array() in src/XF/Template/Templater.php at line 1103
- XF\Template\Templater->func() in internal_data/code_cache/templates/l1/s25/public/post_macros.php at line 451
- XF\Template\Templater->{closure}() in src/XF/Template/Templater.php at line 799
- XF\Template\Templater->callMacro() in internal_data/code_cache/templates/l1/s25/public/post_article_macros.php at line 96
- XF\Template\Templater->{closure}() in src/XF/Template/Templater.php at line 799
- XF\Template\Templater->callMacro() in internal_data/code_cache/templates/l1/s25/public/forum_view_type_article.php at line 144
- XF\Template\Templater->{closure}() in src/XF/Template/Templater.php at line 799
- XF\Template\Templater->callMacro() in internal_data/code_cache/templates/l1/s25/public/forum_view_type_article.php at line 54
- XF\Template\Templater->{closure}() in src/XF/Template/Templater.php at line 962
- XF\Template\Templater->renderExtensionInternal() in src/XF/Template/Templater.php at line 898
- XF\Template\Templater->renderExtension() in internal_data/code_cache/templates/l1/s25/public/forum_view.php at line 641
- XF\Template\Templater->{closure}() in src/XF/Template/Templater.php at line 1626
- XF\Template\Templater->renderTemplate() in src/XF/Template/Templater.php at line 1617
- XF\Template\Templater->renderTemplate() in src/XF/Template/Template.php at line 24
- XF\Template\Template->render() in src/XF/Mvc/Renderer/Html.php at line 48
- XF\Mvc\Renderer\Html->renderView() in src/XF/Mvc/Dispatcher.php at line 458
- XF\Mvc\Dispatcher->renderView() in src/XF/Mvc/Dispatcher.php at line 440
- XF\Mvc\Dispatcher->renderReply() in src/XF/Mvc/Dispatcher.php at line 400
- XF\Mvc\Dispatcher->render() in src/XF/Mvc/Dispatcher.php at line 58
- XF\Mvc\Dispatcher->run() in src/XF/App.php at line 2300
- XF\App->run() in src/XF.php at line 488
- XF::runApp() in index.php at line 20