[wp-trac] [WordPress Trac] #5649: to_ping query optimization
WordPress Trac
wp-trac at lists.automattic.com
Sat Jan 12 16:39:31 GMT 2008
#5649: to_ping query optimization
--------------------------+-------------------------------------------------
Reporter: misterbisson | Owner: anonymous
Type: defect | Status: new
Priority: normal | Milestone: 2.6
Component: Optimization | Version: 2.3.2
Severity: normal | Keywords: to_ping, mysql, query, optimization
--------------------------+-------------------------------------------------
In wp-includes/comment.php, the following query requires a full table scan
and can't be improved by adding an index:
<code>$trackbacks = $wpdb->get_results("SELECT ID FROM $wpdb->posts WHERE
CHAR_LENGTH(TRIM(to_ping)) > 7 AND post_status = 'publish'");</code>
I can't see any obvious reasons why do_trackbacks would leave cruft in the
to_ping field, and any cruft that may exist would get cleared after going
through do_trackbacks again. So I'm proposing this replacement:
$trackbacks = $wpdb->get_results("SELECT ID FROM $wpdb->posts WHERE
to_ping <> '' AND post_status = 'publish'");
--
Ticket URL: <http://trac.wordpress.org/ticket/5649>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list