#Fast WP_Query WP_Query通过使用对象缓存进行MySQL优化
##基准### 1。 选择最后10个帖子(数据库中有7000行)
$ query = new WP_Query ( [ 'post_type' => 'post' , 'posts_per_page' => 10 ] );
####默认SQL:
SELECT SQL_CALC_FOUND_ROWS wp_posts . ID FROM wp_posts WHERE 1 = 1 AND wp_posts . post_type = ' post ' AND ( wp_posts . post_status = ' publish ' ) ORDER BY wp_posts . post_date DESC LIMIT 0 , 10 ;
查询时间: 31.588毫秒
####使用插件SQL:
SELEC
2021-11-30 21:52:03
2KB
PHP
1