Query
This is a 1:1 copy of the DB data (only a few days older). Only different DB versions mySQL vs mariaDB
I see that there is a temporary sorting! Indexes exist... As written a 1:1 copy on both systems. One system has no problem with that.
Attachment Indexes-Screenshot
Using Union -
Server 1:
Run Time: 3.232797
Server 2:
Run Time: 0.029622
Anybody got any ideas? Thanks
Code:
SELECT `xf_thread`.*, `xf_forum_Forum_1`.*, `xf_node_Node_2`.*, `xf_user_User_3`.*, `xf_permission_cache_content_Permissions_4`.*
FROM `xf_thread` FORCE INDEX (`last_post_date`)
LEFT JOIN `xf_forum` AS `xf_forum_Forum_1` ON (`xf_forum_Forum_1`.`node_id` = `xf_thread`.`node_id`)
LEFT JOIN `xf_node` AS `xf_node_Node_2` ON (`xf_node_Node_2`.`node_id` = `xf_forum_Forum_1`.`node_id`)
LEFT JOIN `xf_user` AS `xf_user_User_3` ON (`xf_user_User_3`.`user_id` = `xf_thread`.`user_id`)
LEFT JOIN `xf_permission_cache_content` AS `xf_permission_cache_content_Permissions_4` ON (`xf_permission_cache_content_Permissions_4`.`content_type` = 'node' AND `xf_permission_cache_content_Permissions_4`.`content_id` = `xf_node_Node_2`.`node_id` AND `xf_permission_cache_content_Permissions_4`.`permission_combination_id` = '304')
WHERE (`xf_thread`.`discussion_state` = 'visible') AND (`xf_thread`.`discussion_type` <> 'redirect') AND (`xf_node_Node_2`.`display_in_list` = 1) AND ((`xf_node_Node_2`.`node_id` IN (12)) OR (`xf_node_Node_2`.`parent_node_id` IN (12)))
ORDER BY `xf_thread`.`last_post_date` DESC
LIMIT 20
This is a 1:1 copy of the DB data (only a few days older). Only different DB versions mySQL vs mariaDB
I see that there is a temporary sorting! Indexes exist... As written a 1:1 copy on both systems. One system has no problem with that.
Attachment Indexes-Screenshot
Using Union -
Server 1:
Run Time: 3.232797
Select Type | Table | Type | Possible Keys | Key | Key Len | Ref | Rows | Extra |
---|---|---|---|---|---|---|---|---|
SIMPLE | xf_node_Node_2 | index_merge | PRIMARY,parent_node_id,display_in_list,display_in_list_2 | PRIMARY,parent_node_id | 4,4 | 10 | Using union(PRIMARY,parent_node_id); Using where; Using temporary; Using filesort | |
SIMPLE | xf_forum_Forum_1 | eq_ref | PRIMARY,get_nodes | PRIMARY | 4 | ah_xenforo.xf_node_Node_2.node_id | 1 | |
SIMPLE | xf_thread | ALL | 615242 | Using where; Using join buffer (Block Nested Loop) | ||||
SIMPLE | xf_user_User_3 | eq_ref | PRIMARY | PRIMARY | 4 | ah_xenforo.xf_thread.user_id | 1 | |
SIMPLE | xf_permission_cache_content_Permissions_4 | eq_ref | PRIMARY,content_id,content_type,content,tes | PRIMARY | 35 | const,const,ah_xenforo.xf_node_Node_2.node_id | 1 | Using where |
Server 2:
Run Time: 0.029622
Select Type | Table | Type | Possible Keys | Key | Key Len | Ref | Rows | Extra |
---|---|---|---|---|---|---|---|---|
SIMPLE | xf_thread | index | last_post_date | 4 | 595007 | Using where | ||
SIMPLE | xf_forum_Forum_1 | eq_ref | PRIMARY,get_nodes | PRIMARY | 4 | 2androidhilfe.xf_thread.node_id | 1 | |
SIMPLE | xf_node_Node_2 | eq_ref | PRIMARY,parent_node_id,display_in_list,display_in_list_2 | PRIMARY | 4 | 2androidhilfe.xf_thread.node_id | 1 | Using where |
SIMPLE | xf_user_User_3 | eq_ref | PRIMARY | PRIMARY | 4 | 2androidhilfe.xf_thread.user_id | 1 | |
SIMPLE | xf_permission_cache_content_Permissions_4 | eq_ref | PRIMARY,content_id,content_type,content,tes | content_id | 35 | 2androidhilfe.xf_thread.node_id,const,const | 1 | Using where |
Anybody got any ideas? Thanks