Make WordPress Core


Ignore:
Timestamp:
09/19/2019 02:05:25 AM (5 years ago)
Author:
boonebgorges
Message:

Improve performance of trackback query in do_all_pings().

Previously, the direct SQL query used to identify trackbacks in
do_all_pings() performed poorly, due to an unindexed query against the
to_ping column. We improve performance in two ways. First, we switch
to using a postmeta flag for posts that require trackbacks to be sent;
queries joining against the postmeta table that check only the meta_key
are generally quite fast. Second, we switch to the use of WP_Query,
making the query cacheable and filterable using standard methods.

Props dshanske, spacedmonkey, janw.oostendorp, mrmadhat, birgire.
Fixes #36824.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/post.php

    r46076 r46178  
    67876787    add_post_meta( $post_id, '_encloseme', '1' );
    67886788
     6789    $to_ping = get_to_ping( $post_id );
     6790    if ( ! empty( $to_ping ) ) {
     6791        add_post_meta( $post_id, '_trackbackme', '1' );
     6792    }
     6793
    67896794    if ( ! wp_next_scheduled( 'do_pings' ) ) {
    67906795        wp_schedule_single_event( time(), 'do_pings' );
Note: See TracChangeset for help on using the changeset viewer.