nocte
Well-known member
- Affected version
- 2.1.6
After upgrading from XF1.5 (with XFMG) to XF2.1 we had a "latest comment" widget on the Gallery index, that caused a slow query. In fact it was that slow, that it caused a timeout.
I assume this widget is only present by default after an upgrade from XF1 to XF2.
To avoid the slow queries, I'd suggest to include a max age limit to for the "latest comments" widget and set it to a few days by default, because otherwise there seems to be a full table scan:
If you don't want to include this, you should disable the widget creation on upgrade.
I assume this widget is only present by default after an upgrade from XF1 to XF2.
To avoid the slow queries, I'd suggest to include a max age limit to for the "latest comments" widget and set it to a few days by default, because otherwise there seems to be a full table scan:
SQL:
SELECT `xf_mg_comment`.*, `xf_mg_album_Album_1`.*, `xf_mg_media_item_Media_2`.*, `xf_mg_category_Category_3`.*, `xf_mg_album_Album_4`.*, `xf_mg_category_Category_5`.*, `xf_mg_rating_Rating_6`.*
FROM `xf_mg_comment`
LEFT JOIN `xf_mg_album` AS `xf_mg_album_Album_1` ON (`xf_mg_comment`.`content_type` = 'xfmg_album' AND `xf_mg_album_Album_1`.`album_id` = `xf_mg_comment`.`content_id`)
LEFT JOIN `xf_mg_media_item` AS `xf_mg_media_item_Media_2` ON (`xf_mg_comment`.`content_type` = 'xfmg_media' AND `xf_mg_media_item_Media_2`.`media_id` = `xf_mg_comment`.`content_id`)
LEFT JOIN `xf_mg_category` AS `xf_mg_category_Category_3` ON (`xf_mg_category_Category_3`.`category_id` = `xf_mg_album_Album_1`.`category_id`)
LEFT JOIN `xf_mg_album` AS `xf_mg_album_Album_4` ON (`xf_mg_album_Album_4`.`album_id` = `xf_mg_media_item_Media_2`.`album_id`)
LEFT JOIN `xf_mg_category` AS `xf_mg_category_Category_5` ON (`xf_mg_category_Category_5`.`category_id` = `xf_mg_media_item_Media_2`.`category_id`)
LEFT JOIN `xf_mg_rating` AS `xf_mg_rating_Rating_6` ON (`xf_mg_rating_Rating_6`.`rating_id` = `xf_mg_comment`.`rating_id`)
WHERE (`xf_mg_comment`.`comment_state` = 'visible')
ORDER BY `xf_mg_comment`.`comment_date` DESC, `xf_mg_comment`.`comment_id` DESC
LIMIT 50
If you don't want to include this, you should disable the widget creation on upgrade.