I've been having some problems with a large website (50.000 articles), and, after a bit of debugging, I came across these issues:
1. Category Blog view
I built a menu item linking to a category blog display, with 10 articles per page (the category contains 4000 articles). On debug I get the following info:
Code: Select all
Profile Information
Application 0.000 seconds (+0.000); 1.17 MB (+1.167) - afterLoad
Application 0.118 seconds (+0.117); 7.35 MB (+6.179) - afterInitialise
Application 0.190 seconds (+0.072); 9.51 MB (+2.164) - afterRoute
Application 9.626 seconds (+9.437); 23.23 MB (+13.722) - afterDispatch
Application 9.633 seconds (+0.006); 23.47 MB (+0.239) - beforeRenderModule mod_menu (Categories)
Application 10.175 seconds (+0.543); 23.73 MB (+0.258) - afterRenderModule mod_menu (Categories)
Application 10.175 seconds (+0.000); 23.72 MB (-0.010) - beforeRenderModule mod_menu (Main Menu)
Application 10.180 seconds (+0.005); 23.72 MB (-0.004) - afterRenderModule mod_menu (Main Menu)
Application 11.423 seconds (+1.243); 23.83 MB (+0.112) - afterRender
Memory Usage
23.89 MB (25,046,384 Bytes)
After playing around with the queries, I found these 2:
Code: Select all
SELECT a.id, a.title, a.alias, a.title_alias, a.introtext, a.checked_out, a.checked_out_time, a.catid, a.created, a.created_by, a.created_by_alias, CASE WHEN a.modified = 0 THEN a.created ELSE a.modified END as modified, a.modified_by, uam.name as modified_by_name,CASE WHEN a.publish_up = 0 THEN a.created ELSE a.publish_up END as publish_up, a.publish_down, a.attribs, a.metadata, a.metakey, a.metadesc, a.access, a.hits, a.xreference, a.featured, LENGTH(a.fulltext) AS readmore ,CASE WHEN badcats.id is not null THEN 0 ELSE a.state END AS state,c.title AS category_title, c.path AS category_route, c.access AS category_access, c.alias AS category_alias,CASE WHEN a.created_by_alias > ' ' THEN a.created_by_alias ELSE ua.name END AS author,ua.email AS author_email,contact.id as contactid,parent.title as parent_title, parent.id as parent_id, parent.path as parent_route, parent.alias as parent_alias,ROUND( v.rating_sum / v.rating_count ) AS rating, v.rating_count as rating_count,c.published, CASE WHEN badcats.id is null THEN c.published ELSE 0 END AS parents_published
FROM k1fhu_content AS a
LEFT JOIN k1fhu_content_frontpage AS fp
ON fp.content_id = a.id
LEFT JOIN k1fhu_categories AS c
ON c.id = a.catid
LEFT JOIN k1fhu_users AS ua
ON ua.id = a.created_by
LEFT JOIN k1fhu_users AS uam
ON uam.id = a.modified_by
LEFT JOIN k1fhu_contact_details AS contact
on contact.user_id = a.created_by
LEFT JOIN k1fhu_categories as parent
ON parent.id = c.parent_id
LEFT JOIN k1fhu_content_rating AS v
ON a.id = v.content_id
LEFT
OUTER JOIN (SELECT cat.id as id
FROM k1fhu_categories AS cat JOIN k1fhu_categories AS parent
ON cat.lft BETWEEN parent.lft
AND parent.rgt
WHERE parent.extension = 'com_content'
AND parent.published != 1
GROUP BY cat.id ) AS badcats
ON badcats.id = c.id
WHERE a.access IN (1,1)
AND CASE WHEN badcats.id is null THEN a.state ELSE 0 END = 1
AND a.catid = 33
AND (a.publish_up = '0000-00-00 00:00:00' OR a.publish_up <= '2011-12-06 13:34:17')
AND (a.publish_down = '0000-00-00 00:00:00' OR a.publish_down >= '2011-12-06 13:34:17')
GROUP BY a.id
ORDER BY c.lft, CASE WHEN a.publish_up = 0 THEN a.created ELSE a.publish_up END DESC , a.created
LIMIT 0, 10
SELECT a.id, a.title, a.alias, a.title_alias, a.introtext, a.checked_out, a.checked_out_time, a.catid, a.created, a.created_by, a.created_by_alias, CASE WHEN a.modified = 0 THEN a.created ELSE a.modified END as modified, a.modified_by, uam.name as modified_by_name,CASE WHEN a.publish_up = 0 THEN a.created ELSE a.publish_up END as publish_up, a.publish_down, a.attribs, a.metadata, a.metakey, a.metadesc, a.access, a.hits, a.xreference, a.featured, LENGTH(a.fulltext) AS readmore ,CASE WHEN badcats.id is not null THEN 0 ELSE a.state END AS state,c.title AS category_title, c.path AS category_route, c.access AS category_access, c.alias AS category_alias,CASE WHEN a.created_by_alias > ' ' THEN a.created_by_alias ELSE ua.name END AS author,ua.email AS author_email,contact.id as contactid,parent.title as parent_title, parent.id as parent_id, parent.path as parent_route, parent.alias as parent_alias,ROUND( v.rating_sum / v.rating_count ) AS rating, v.rating_count as rating_count,c.published, CASE WHEN badcats.id is null THEN c.published ELSE 0 END AS parents_published
FROM k1fhu_content AS a
LEFT JOIN k1fhu_content_frontpage AS fp
ON fp.content_id = a.id
LEFT JOIN k1fhu_categories AS c
ON c.id = a.catid
LEFT JOIN k1fhu_users AS ua
ON ua.id = a.created_by
LEFT JOIN k1fhu_users AS uam
ON uam.id = a.modified_by
LEFT JOIN k1fhu_contact_details AS contact
on contact.user_id = a.created_by
LEFT JOIN k1fhu_categories as parent
ON parent.id = c.parent_id
LEFT JOIN k1fhu_content_rating AS v
ON a.id = v.content_id
LEFT
OUTER JOIN (SELECT cat.id as id
FROM k1fhu_categories AS cat JOIN k1fhu_categories AS parent
ON cat.lft BETWEEN parent.lft
AND parent.rgt
WHERE parent.extension = 'com_content'
AND parent.published != 1
GROUP BY cat.id ) AS badcats
ON badcats.id = c.id
WHERE a.access IN (1,1)
AND CASE WHEN badcats.id is null THEN a.state ELSE 0 END = 1
AND a.catid = 33
AND (a.publish_up = '0000-00-00 00:00:00' OR a.publish_up <= '2011-12-06 13:34:17')
AND (a.publish_down = '0000-00-00 00:00:00' OR a.publish_down >= '2011-12-06 13:34:17')
GROUP BY a.id
ORDER BY c.lft, CASE WHEN a.publish_up = 0 THEN a.created ELSE a.publish_up END DESC , a.created
The second one is weird, as far as I can see it is the same as the first one, only it doesn't have LIMIT, so it actually grabs the whole 4000 articles from that category. I don't see any reason why this should happen (there are no modules of any sort on the page).
2. Modules (Latest/Most Read Articles)
On the main page I've got 2 modules that seem to take forever to load. One is Latest Articles, the other one is for Popular Articles (sorted by hits).
Now, this isn't the same issue as the first one (otherwise it would kill my website), but still, a query like this takes over 10 seconds to execute:
Code: Select all
SELECT a.id, a.title, a.alias, a.title_alias, a.introtext, a.checked_out, a.checked_out_time, a.catid, a.created, a.created_by, a.created_by_alias, CASE WHEN a.modified = 0 THEN a.created ELSE a.modified END as modified, a.modified_by, uam.name as modified_by_name,CASE WHEN a.publish_up = 0 THEN a.created ELSE a.publish_up END as publish_up, a.publish_down, a.attribs, a.metadata, a.metakey, a.metadesc, a.access, a.hits, a.xreference, a.featured, LENGTH(a.fulltext) AS readmore ,CASE WHEN badcats.id is not null THEN 0 ELSE a.state END AS state,c.title AS category_title, c.path AS category_route, c.access AS category_access, c.alias AS category_alias,CASE WHEN a.created_by_alias > ' ' THEN a.created_by_alias ELSE ua.name END AS author,ua.email AS author_email,contact.id as contactid,parent.title as parent_title, parent.id as parent_id, parent.path as parent_route, parent.alias as parent_alias,ROUND( v.rating_sum / v.rating_count ) AS rating, v.rating_count as rating_count,c.published, CASE WHEN badcats.id is null THEN c.published ELSE 0 END AS parents_published
FROM k1fhu_content AS a
LEFT JOIN k1fhu_content_frontpage AS fp
ON fp.content_id = a.id
LEFT JOIN k1fhu_categories AS c
ON c.id = a.catid
LEFT JOIN k1fhu_users AS ua
ON ua.id = a.created_by
LEFT JOIN k1fhu_users AS uam
ON uam.id = a.modified_by
LEFT JOIN k1fhu_contact_details AS contact
on contact.user_id = a.created_by
LEFT JOIN k1fhu_categories as parent
ON parent.id = c.parent_id
LEFT JOIN k1fhu_content_rating AS v
ON a.id = v.content_id
LEFT
OUTER JOIN (SELECT cat.id as id
FROM k1fhu_categories AS cat JOIN k1fhu_categories AS parent
ON cat.lft BETWEEN parent.lft
AND parent.rgt
WHERE parent.extension = 'com_content'
AND parent.published != 1
GROUP BY cat.id ) AS badcats
ON badcats.id = c.id
WHERE a.access IN (1,1)
AND CASE WHEN badcats.id is null THEN a.state ELSE 0 END = 1
AND a.catid IN (8,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,58)
AND (a.publish_up = '0000-00-00 00:00:00' OR a.publish_up <= '2011-12-06 13:37:36')
AND (a.publish_down = '0000-00-00 00:00:00' OR a.publish_down >= '2011-12-06 13:37:36')
GROUP BY a.id
ORDER BY a.hits DESC
LIMIT 0, 5
P.S.: Note that I am using SEBLOD 2.0 GA cck and AceSEF 1.7.6.
Cheers!