[wp-trac] [WordPress Trac] #18536: Improve performance of WP_Query core
WordPress Trac
wp-trac at lists.automattic.com
Sun Jan 22 18:55:27 UTC 2012
#18536: Improve performance of WP_Query core
-----------------------------+--------------------
Reporter: cheald | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: 3.4
Component: Performance | Version: 3.2.1
Severity: normal | Resolution:
Keywords: early has-patch |
-----------------------------+--------------------
Comment (by darioj):
Very good patch, it helped a lot reducing disk tmp tables, locking and key
write requests.
It was applied in production but we had to add the if $ids empty check to
the find_posts_from_ids() funtion:
{{{
function find_posts_from_ids($posts) {
global $wpdb, $saved_posts_count, $last_order_clause;
$ids = array();
if(is_array($posts)) {
foreach($posts as $post) { $ids[] = $post->ID; }
}
$saved_posts_count = $wpdb->get_var( 'SELECT FOUND_ROWS()' );
if(is_array($ids) && $ids[0] != '') {
return $wpdb->get_results("SELECT * FROM {$wpdb->posts} WHERE ID IN
(" . implode(",", $ids) . ") $last_order_clause;");
}
}
}}}
Cheers
Dario
--
Ticket URL: <http://core.trac.wordpress.org/ticket/18536#comment:36>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list