[Plugin: WordPress SEO by Yoast] Performance Suggestion
-
Your code:
$posts = $wpdb->get_results("SELECT ID, post_content, post_name, post_author, post_parent, post_modified_gmt, post_date, post_date_gmt FROM $wpdb->posts WHERE post_status = 'publish' AND post_password = '' AND post_type = '$post_type' ORDER BY post_modified ASC LIMIT $steps OFFSET $offset");My Code
$posts = $wpdb->get_results("SELECT l.ID, post_content, post_name, post_author, post_parent, post_modified_gmt, post_date, post_date_gmt FROM ( SELECT ID FROM $wpdb->posts WHERE post_status = 'publish' AND post_password = '' AND post_type = '$post_type' ORDER BY post_modified ASC LIMIT $steps OFFSET $offset) o JOIN $wpdb->posts l ON l.ID = o.id ORDER BY l.id");Should be app. 100 times faster. See here:
http://explainextended.com/2009/10/23/mysql-order-by-limit-performance-late-row-lookups/On large Blogs (we have > 100.000 posts on http://www.naanoo.com) otherwise the database queries caused by the plugin will kill the server.
With sunny regards from Germany,
Sebastian
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
The topic ‘[Plugin: WordPress SEO by Yoast] Performance Suggestion’ is closed to new replies.