I am just in the process of trying to make my site as lean as possible before it goes live, so I have enabled debug mode to try and see if there are any extra queries I could reduce and I have noticed that on say the forum index, the footer will say 10 queries, but when you click on it, the debug page says there are 14.
Any idea why the debug page would show more queries?
The debug query count is being fetched and set to the template, BEFORE all operations are finished.
All the events executed after calling $template->setParams(XenForo_Debug::getDebugTemplateParams()); won't be counted to the query count .
If you want the REAL query count, you need to call XenForo_Application::getDb()->getProfiler()->getTotalNumQueries(); as LAST operation, just before the response is being sent to the client and output the phrase (I'm using an event listener on front_controller_post_view to get the REAL query count)