Make WordPress Core

Changeset 10446


Ignore:
Timestamp:
01/26/2009 10:34:50 PM (15 years ago)
Author:
ryan
Message:

Force the index only for 0 OR 1 queries. see #7415

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/template.php

    r10445 r10446  
    19221922    $post = (int) $post;
    19231923    $count = wp_count_comments();
    1924 
     1924    $index = '';
     1925   
    19251926    if ( 'moderated' == $status ) {
    19261927        $approved = "comment_approved = '0'";
     
    19351936        $approved = "( comment_approved = '0' OR comment_approved = '1' )";
    19361937        $total = $count->moderated + $count->approved;
     1938        $index = 'USE INDEX (comment_date_gmt)';
    19371939    }
    19381940
     
    19721974            $typesql";
    19731975    } else {
    1974         $query = "FROM $wpdb->comments USE INDEX (comment_date_gmt) WHERE $approved $post $typesql";
     1976        $query = "FROM $wpdb->comments $index WHERE $approved $post $typesql";
    19751977    }
    19761978
Note: See TracChangeset for help on using the changeset viewer.