[wp-trac] [WordPress Trac] #36824: do_all_pings function queries all posts

WordPress Trac noreply at wordpress.org
Thu May 12 13:23:38 UTC 2016


#36824: do_all_pings function queries all posts
------------------------------+-----------------------------
 Reporter:  spacedmonkey      |      Owner:
     Type:  enhancement       |     Status:  new
 Priority:  normal            |  Milestone:  Awaiting Review
Component:  Pings/Trackbacks  |    Version:  2.1
 Severity:  normal            |   Keywords:
  Focuses:  performance       |
------------------------------+-----------------------------
 In the do_all_pings function, the following sql query runs.

 SELECT ID FROM $wpdb->posts WHERE to_ping <> '' AND post_status =
 'publish'

 Performance monitor tool (new relic) has flagged this has a bad query.  It
 said the following

 This table was retrieved with a full table scan, which is often quite bad
 for performance, unless you only retrieve a few rows.
 The table was retrieved with this index:
 No index was used in this part of the query.
 You can speed up this query by querying only fields that are within the
 index. Or you can create an index that includes every field in your query,
 including the primary key.
 Approximately 114860 rows of this table were scanned.

 I don't understand why this call isn't going through the wp query object.
 If it did you could then cache the result.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/36824>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list