[wp-hackers] to_ping query optimization

Andy Skelton skeltoac at gmail.com
Fri Jan 11 23:33:18 GMT 2008


On Jan 11, 2008 5:00 PM, Casey Bisson <casey.bisson at gmail.com> wrote:
> It works beautifully when written as below, but what am I losing? How
> important is the "CHAR_LENGTH(TRIM(to_ping)) > 7" piece?
>
> $trackbacks = $wpdb->get_results("SELECT ID FROM $wpdb->posts WHERE
> to_ping <> '' AND post_status = 'publish'");

Hey Casey! Your query looks great to my eyes. I would guess that the
existing code was written to avoid selecting rows full of spaces or
shorter than 'http://' (7 chars). It would be more efficient to a) use
your query, and b) make sure the field is empty when all valid pings
have been sent.

Could you create a trac ticket and upload a patch with your changes?

Andy


More information about the wp-hackers mailing list