admin管理员组文章数量:1434900
I've WP installation with some 120K posts. One of the slow queries that frequently appear at @mysql-slow.log is below
# Query_time: 1.744827 Lock_time: 0.000567 Rows_sent: 1 Rows_examined: 635732
SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts LEFT JOIN wp_postmeta ON
(wp_posts.ID = wp_postmeta.post_id AND wp_postmeta.meta_key = 'sort_order_' ) WHERE 1=1
AND (wp_postmeta.post_id IS NULL) AND wp_posts.post_type IN ('post', 'photo', 'video')
AND ((wp_posts.post_status = 'publish')) GROUP BY wp_posts.ID ORDER BY wp_posts.post_date DESC LIMIT 0, 10;
And that is caused by WP_Query with meta_query arguments
$args = array(
'post_type' => array('post','photo','video'),
'post_status'=> 'publish',
'posts_per_page' => 10,
'meta_query' => array(
'relation' => 'AND',
array( 'key' => 'sort_order_', 'compare' => 'NOT EXISTS')
),
);
Is there any way to speed up this query. May be like indexing. But how? Any help will be greatly appreciated . Thank you
本文标签: mysqlWordpress Query optimaization for slow query
版权声明:本文标题:mysql - Wordpress Query optimaization for slow query 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745642965a2667966.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论