0

Maybe someone can help me with this issue. My site has a slow query:

SELECT DISTINCT i.*, g.title AS groupname, c.name AS category, v.name AS author, w.name as moderator, u.name AS editor 
FROM p38xt_k2_items as i 
LEFT JOIN p38xt_k2_categories AS c ON c.id = i.catid 
LEFT JOIN p38xt_viewlevels AS g ON g.id = i.access 
LEFT JOIN p38xt_users AS u ON u.id = i.checked_out 
LEFT JOIN p38xt_users AS v ON v.id = i.created_by 
LEFT JOIN p38xt_users AS w ON w.id = i.modified_by 
WHERE i.trash=0 ORDER BY i.id DESC LIMIT 0, 50;

I have checked every module that does k2 feeds, but was unable to find the 50 limit. I also opened all .php of the /modules/* but even there I could not find: SELECT DISTINCT i.*, g.title

Does someone know were this query might be generated?! Is there any Joomla Extension that can track the queries executed from the modules?!

Solution: The issue of this problem was the K2 multicategory plugin that I was using on the site!

  • Please can you use the code format for your query so we can easily read it? – Lodder Apr 14 '16 at 10:43
0

Enable the system debug in Global Configuration/System.

Open a page using k2 and in the Joomla! Debug Console under Database Queries you will find every query executed on that page with execution time, used memory and a Call Stack that identifies every file involved.


You can also change allowed user groups and other options of System - Debug plugin under Extensions > Plugin to customize the debug console.

UPDATE: after some research the query was actually executed in backend area by latest k2 items module.

  • Hello, Can I just enable the debug in frontend just for the logged in Administrator users?! – Klaus Veliu Apr 15 '16 at 8:26
  • I've updated my question with more info about settings of system debug plugin – Kitase88 Apr 15 '16 at 8:44
  • I followed your suggestions and something weird happen. The query was not shown in the debug area. I tested that in the homepage were all the modules are loaded and the query was not there. I am attaching the results so maybe you can give me some advice.dropbox.com/s/o3q5rdi82z87h3g/debug.html?dl=0 – Klaus Veliu Apr 15 '16 at 9:57
  • How or where did you first found the slow query in your question? Anyway worst query time in this debug is executed from mod_k2_tools, could it be the problem? – Kitase88 Apr 15 '16 at 10:48
  • I contacted siteground support and they told me the 500 error of the site was caused because the slow query triggered the auto killing of apache and mysql. I have read that k2 tag creates some load, but that query its not the same with the slow query that I got from the support. As I don't have experience in this issue, could your tell me if the time and load of the queries are normal?! – Klaus Veliu Apr 15 '16 at 10:59
0

Use EXPLAIN and check which column have more data and taking time and which field require indexing and then apply it and check speed.

EXPLAIN DISTINCT i.*, g.title AS groupname, c.name AS category, v.name AS author, w.name as moderator, u.name AS editor 
FROM p38xt_k2_items as i 
LEFT JOIN p38xt_k2_categories AS c ON c.id = i.catid 
LEFT JOIN p38xt_viewlevels AS g ON g.id = i.access 
LEFT JOIN p38xt_users AS u ON u.id = i.checked_out 
LEFT JOIN p38xt_users AS v ON v.id = i.created_by 
LEFT JOIN p38xt_users AS w ON w.id = i.modified_by 
WHERE i.trash=0 ORDER BY i.id DESC LIMIT 0, 50;
  • I want to delete the module/plugin/component* that its causing this query! – Klaus Veliu Apr 14 '16 at 18:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.