فتحات العرب Joomla! • Index page: Performance - Joomla! 3.x • Re: Slow SQL Queries after Upgrading from 1.5 to 3.x

Saturday, April 11, 2015

Performance - Joomla! 3.x • Re: Slow SQL Queries after Upgrading from 1.5 to 3.x

The "Rows_sent: 5293" is exactly the number of entries in #_content

In #__content_frontpage i have actually 188 entries



i actually dont know where these query run.

on article-page i see in phpmyadmin these query:

Code:

SELECT a.id, a.title, a.alias, a.introtext, a.fulltext, a.checked_out, a.checked_out_time, a.catid, a.created, a.created_by, a.created_by_alias,

CASE WHEN a.modified = '0000-00-00 00:00:00'

THEN a.created

ELSE a.modified

END AS modified, a.modified_by, uam.name AS modified_by_name,

CASE WHEN a.publish_up = '0000-00-00 00:00:00'

THEN a.created

ELSE a.publish_up

END AS publish_up, a.publish_down, a.images, a.urls, a.attribs, a.metadata, a.metakey, a.metadesc, a.access, a.hits, a.xreference, a.featured, a.language, 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, 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, 0 ) 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 ngie_content AS a

LEFT JOIN ngie_content_frontpage AS fp ON fp.content_id = a.id

LEFT JOIN ngie_categories AS c ON c.id = a.catid

LEFT JOIN ngie_users AS ua ON ua.id = a.created_by

LEFT JOIN ngie_users AS uam ON uam.id = a.modified_by

LEFT JOIN ngie_categories AS parent ON parent.id = c.parent_id

LEFT JOIN ngie_content_rating AS v ON a.id = v.content_id

LEFT OUTER JOIN (



SELECT cat.id AS id

FROM ngie_categories AS cat

JOIN ngie_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, 5 )

AND c.access

IN ( 1, 1, 5 )

AND CASE WHEN badcats.id IS NULL

THEN a.state

ELSE 0

END =1

AND a.featured =1

AND (

a.publish_up = '0000-00-00 00:00:00'

OR a.publish_up <= '2015-04-11 08:05:17'

)

AND (

a.publish_down = '0000-00-00 00:00:00'

OR a.publish_down >= '2015-04-11 08:05:17'

)

ORDER BY a.publish_up DESC

LIMIT 0 , 1



Its only 1 row. So i think this is correct





On frontpage i see these querie:

Code:

SELECT a.id, a.title, a.alias, a.introtext, a.fulltext, a.images, a.hits, a.catid AS category_id, c.title AS category_name, c.alias AS category_alias, u.id AS user_id, u.name AS user_name, a.created_by_alias AS user_alias, ROUND( AVG( r.rating_sum / r.rating_count ) , 2 ) AS rating_average, r.rating_count, a.created AS date, COUNT( cm.id ) AS comments_count, MAX( cm.date ) AS comments_date

FROM ngie_content AS a

LEFT JOIN ngie_categories AS c ON c.id = a.catid

LEFT JOIN ngie_users AS u ON u.id = a.created_by

LEFT JOIN ngie_content_rating AS r ON r.content_id = a.id

LEFT JOIN ngie_jcomments AS cm ON cm.object_id = a.id

AND cm.object_group = "com_content"

AND cm.published =1

WHERE a.id NOT

IN ( 10351, 10352, 10353, 10354 )

AND a.state =1

AND c.published =1

AND a.access

IN ( 1, 1, 5 )

AND c.access

IN ( 1, 1, 5 )

AND a.publish_up <= "2015-04-11 08:10:59"

GROUP BY a.id

ORDER BY date DESC

LIMIT 0 , 12



it shows the 12 newest entries. so this is correct



on category-page:

Code:

SELECT a.id, a.title, a.alias, a.introtext, a.fulltext, a.checked_out, a.checked_out_time, a.catid, a.created, a.created_by, a.created_by_alias,

CASE WHEN a.modified = '0000-00-00 00:00:00'

THEN a.created

ELSE a.modified

END AS modified, a.modified_by, uam.name AS modified_by_name,

CASE WHEN a.publish_up = '0000-00-00 00:00:00'

THEN a.created

ELSE a.publish_up

END AS publish_up, a.publish_down, a.images, a.urls, a.attribs, a.metadata, a.metakey, a.metadesc, a.access, a.hits, a.xreference, a.featured, a.language, 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, 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, 0 ) 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 ngie_content AS a

LEFT JOIN ngie_content_frontpage AS fp ON fp.content_id = a.id

LEFT JOIN ngie_categories AS c ON c.id = a.catid

LEFT JOIN ngie_users AS ua ON ua.id = a.created_by

LEFT JOIN ngie_users AS uam ON uam.id = a.modified_by

LEFT JOIN ngie_categories AS parent ON parent.id = c.parent_id

LEFT JOIN ngie_content_rating AS v ON a.id = v.content_id

LEFT OUTER JOIN (



SELECT cat.id AS id

FROM ngie_categories AS cat

JOIN ngie_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, 5 )

AND c.access

IN ( 1, 1, 5 )

AND CASE WHEN badcats.id IS NULL

THEN a.state

ELSE 0

END =1

AND a.catid =39

AND (

a.publish_up = '0000-00-00 00:00:00'

OR a.publish_up <= '2015-04-11 08:12:03'

)

AND (

a.publish_down = '0000-00-00 00:00:00'

OR a.publish_down >= '2015-04-11 08:12:03'

)

ORDER BY a.created DESC , a.created

LIMIT 0 , 12



shows the 12 newest articles in a category-page.

its also correct



but i dont know what produces these query with ALL of my articles.

I have no site where shown all articles at one page



so i am very confused :(

Statistics: Posted by HDsportsAT — Sat Apr 11, 2015 8:20 am








via Joomla! http://ift.tt/1ckKdX2

No comments:

Post a Comment