• REGISTRATION REQUIREMENTS:

    Your username here MUST MATCH your XenForo username (connected to your XF license).

    Once you have registered here, then you need to start a conversation at xenforo.com w/Bob and provide the following:
    1. Your XenForo License Validation Token
    2. The Domain Name associated with the License
    NOTE: Your account will be validated once ALL requirements are verified/met. Thank you for your patience.

Awaiting Feedback Performance issues -- Slow Queries

JustinHawk

New Member
AMS Premium
CAS Premium
IMS Premium
LD Premium
RMS Premium
SC Premium
UBS Premium
We are facing some performance issues with this addon MariaDB. We have more than 90K articles published. Problem happens generally only on the first page of categories. Other than that i have already optimized and brought it down to like 0.001 sec But category first page is slow but bearable. To speed it up, i setup an automation at my end, which works great. But i would really appreciate if you have any more insights or advice you would like to share with me.

Code:
# Thread_id: 4614988  Schema: sql_thcom  QC_hit: No
# Query_time: 70.884838  Lock_time: 0.000012  Rows_sent: 0  Rows_examined: 96022
# Rows_affected: 0  Bytes_sent: 0
SET timestamp=1721009472;
SELECT `xf_xa_ams_article`.*, `xf_user_User_1`.*
            FROM `xf_xa_ams_article`
            LEFT JOIN `xf_user` AS `xf_user_User_1` ON (`xf_user_User_1`.`user_id` = `xf_xa_ams_article`.`user_id`)
            WHERE (`xf_xa_ams_article`.`article_state` = 'awaiting') AND (`xf_xa_ams_article`.`publish_date` <= 1721009401);

Code:
# Query_time: 10.770874  Lock_time: 0.000015  Rows_sent: 3  Rows_examined: 96039
# Rows_affected: 0  Bytes_sent: 421888
SET timestamp=1721009503;
SELECT `xf_xa_ams_article`.*, `xf_user_User_1`.*, `xf_xa_ams_category_Category_2`.*
            FROM `xf_xa_ams_article`
            LEFT JOIN `xf_user` AS `xf_user_User_1` ON (`xf_user_User_1`.`user_id` = `xf_xa_ams_article`.`user_id`)
LEFT JOIN `xf_xa_ams_category` AS `xf_xa_ams_category_Category_2` ON (`xf_xa_ams_category_Category_2`.`category_id` = `xf_xa_ams_article`.`category_id`)
LEFT JOIN `xf_permission_cache_content` AS `xf_permission_cache_content_Permissions_3` ON (`xf_permission_cache_content_Permissions_3`.`content_type` = 'ams_category' AND `xf_permission_cache_content_Permissions_3`.`content_id` = `xf_xa_ams_category_Category_2`.`category_id` AND `xf_permission_cache_content_Permissions_3`.`permission_combination_id` = '1')
            WHERE (`xf_xa_ams_article`.`last_comment_date` > 0) AND (`xf_xa_ams_article`.`article_state` <> 'deleted') AND (`xf_xa_ams_category_Category_2`.`allow_comments` = 1) AND (`xf_xa_ams_article`.`last_comment_date` > 1718417492)
            ORDER BY `xf_xa_ams_article`.`last_comment_date` DESC, `xf_xa_ams_article`.`article_id` DESC
LIMIT 20;

Code:
# Thread_id: 4615117  Schema: sql_thecom  QC_hit: No
# Query_time: 26.571596  Lock_time: 0.000035  Rows_sent: 0  Rows_examined: 52509
# Rows_affected: 0  Bytes_sent: 24576
SET timestamp=1721009500;
SELECT `xf_xa_ams_article`.*, `xf_user_User_1`.*, `xf_xa_ams_article_feature_Featured_2`.*, `xf_attachment_CoverImage_3`.*, `xf_attachment_data_Data_4`.*, `xf_xa_ams_article_read_Read_5`.*, `xf_xa_ams_article_watch_Watch_6`.*, `xf_reaction_content_Reactions_7`.*, `xf_bookmark_item_Bookmarks_8`.*, `xf_xa_ams_category_Category_9`.*, `xf_xa_ams_category_watch_Watch_10`.*, `xf_deletion_log_DeletionLog_11`.*
            FROM `xf_xa_ams_article`
            LEFT JOIN `xf_user` AS `xf_user_User_1` ON (`xf_user_User_1`.`user_id` = `xf_xa_ams_article`.`user_id`)
LEFT JOIN `xf_xa_ams_article_feature` AS `xf_xa_ams_article_feature_Featured_2` ON (`xf_xa_ams_article_feature_Featured_2`.`article_id` = `xf_xa_ams_article`.`article_id`)
LEFT JOIN `xf_attachment` AS `xf_attachment_CoverImage_3` ON (`xf_attachment_CoverImage_3`.`content_type` = 'ams_article' AND `xf_attachment_CoverImage_3`.`content_id` = `xf_xa_ams_article`.`article_id` AND `xf_attachment_CoverImage_3`.`attachment_id` = `xf_xa_ams_article`.`cover_image_id`)
LEFT JOIN `xf_attachment_data` AS `xf_attachment_data_Data_4` ON (`xf_attachment_data_Data_4`.`data_id` = `xf_attachment_CoverImage_3`.`data_id`)
LEFT JOIN `xf_xa_ams_article_read` AS `xf_xa_ams_article_read_Read_5` ON (`xf_xa_ams_article_read_Read_5`.`article_id` = `xf_xa_ams_article`.`article_id` AND `xf_xa_ams_article_read_Read_5`.`user_id` = '1')
LEFT JOIN `xf_xa_ams_article_watch` AS `xf_xa_ams_article_watch_Watch_6` ON (`xf_xa_ams_article_watch_Watch_6`.`article_id` = `xf_xa_ams_article`.`article_id` AND `xf_xa_ams_article_watch_Watch_6`.`user_id` = '1')
LEFT JOIN `xf_reaction_content` AS `xf_reaction_content_Reactions_7` ON (`xf_reaction_content_Reactions_7`.`content_type` = 'ams_article' AND `xf_reaction_content_Reactions_7`.`content_id` = `xf_xa_ams_article`.`article_id` AND `xf_reaction_content_Reactions_7`.`reaction_user_id` = '1')
LEFT JOIN `xf_bookmark_item` AS `xf_bookmark_item_Bookmarks_8` ON (`xf_bookmark_item_Bookmarks_8`.`content_type` = 'ams_article' AND `xf_bookmark_item_Bookmarks_8`.`content_id` = `xf_xa_ams_article`.`article_id` AND `xf_bookmark_item_Bookmarks_8`.`user_id` = '1')
LEFT JOIN `xf_xa_ams_category` AS `xf_xa_ams_category_Category_9` ON (`xf_xa_ams_category_Category_9`.`category_id` = `xf_xa_ams_article`.`category_id`)
LEFT JOIN `xf_xa_ams_category_watch` AS `xf_xa_ams_category_watch_Watch_10` ON (`xf_xa_ams_category_watch_Watch_10`.`category_id` = `xf_xa_ams_category_Category_9`.`category_id` AND `xf_xa_ams_category_watch_Watch_10`.`user_id` = '1')
LEFT JOIN `xf_deletion_log` AS `xf_deletion_log_DeletionLog_11` ON (`xf_deletion_log_DeletionLog_11`.`content_type` = 'ams_article' AND `xf_deletion_log_DeletionLog_11`.`content_id` = `xf_xa_ams_article`.`article_id`)
            WHERE (`xf_xa_ams_article`.`category_id` IN (2)) AND ((`xf_xa_ams_article`.`article_state` IN ('visible', 'deleted', 'moderated'))) AND (`xf_xa_ams_article`.`sticky` = 1) AND (`xf_xa_ams_article`.`category_id` = 2)
            ORDER BY `xf_xa_ams_article`.`publish_date` DESC;
 
Try Xon's recomendation as posted here, this has worked for everyone that has had the same issue as you are having. I had one RMS client that has 5 million items and his went from 30+ seconds to under a second :)


SQL:
set global join_cache_level=0;

Let me know if this works for you :)

Also, XF 2.3 introduces deferred joins and I plan on implementing them for any page with pagination like Index page, Category pages etc.
 
Try Xon's recomendation as posted here, this has worked for everyone that has had the same issue as you are having. I had one RMS client that has 5 million items and his went from 30+ seconds to under a second :)

I have resolved these queries! I remember working with XON, when we were solving these slow query issues :)

Just wanted to share that the queries are still slow.

Also, XF 2.3 introduces deferred joins and I plan on implementing them for any page with pagination like Index page, Category pages etc.
Looking forward to it!

Thanks a lot!
 
Back
Top