将mySQL服务器从5.6升级到5.7时,在vbb5上运行的论坛似乎变得非常慢。查看缓慢的查询文件,看来行扫描比以前慢得多。
下面是典型的论坛查询,该查询在大约1到3秒之前运行,现在运行时间在30到75秒之间。节点表和关闭表分别保存11至1300万条记录。我已经在两个表上执行了表优化。
/**
* Display Product Image in WooCommerce Order Emails
*
* @author James Kemp (Iconic)
*/
add_filter( 'woocommerce_email_order_items_args', 'iconic_email_order_items_args', 10, 1 );
function iconic_email_order_items_args( $args ) {
$args['show_image'] = true;
return $args;
}
我在my.cnf设置上玩过一点,但对提高性能仍然不满意:
# Query_time: 56.239686 Lock_time: 0.000452 Rows_sent: 500 Rows_examined: 672441
SELECT DISTINCT node.starter AS nodeid
FROM node as node
LEFT JOIN node AS starter ON starter.nodeid = IF(node.starter = 0, node.nodeid, node.starter)
JOIN closure AS closure ON node.nodeid = closure.child
WHERE node.contenttypeid <> 30 AND
closure.parent = '47' AND
node.nodeid <> closure.parent AND
node.inlist = 1 AND
node.contenttypeid <> '15' AND
node.protected <> '1'
AND (node.public_preview = 1 OR ( ( ( (starter.parentid IN (13,22,1,2,24,27,33,47,49,62,14,25,28,32,50,52,70,15,29,31,40,44,63,69,6,16,37,38,43,46,51,53,17,30,39,54,55,67,12,18,23,26,34,42,45,20,21,41,48,56,61,82,80,72,79,77,78,76,75,74,68,73,3629857,3654649) ) AND node.showapproved > 0 AND node.viewperms > 1 AND node.showpublished > 0 ))
OR starter.parentid = 9 AND node.userid IN (0)))
ORDER BY starter.created DESC,node.nodeid ASC
LIMIT 500
有人暗示我应该看什么吗?