WordPress.org

Make WordPress Core

Changeset 46878


Ignore:
Timestamp:
12/10/2019 01:45:41 PM (22 months ago)
Author:
SergeyBiryukov
Message:

Comments: Optimize the query for pending comments count in wp_notify_moderator() for better performance on large tables.

Props sgoen.
Fixes #48514.

File:
1 edited

Legend:

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

    r46649 r46878  
    17401740        }
    17411741
    1742         $comments_waiting = $wpdb->get_var( "SELECT count(comment_ID) FROM $wpdb->comments WHERE comment_approved = '0'" );
     1742        $comments_waiting = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '0'" );
    17431743
    17441744        // The blogname option is escaped with esc_html on the way into the database in sanitize_option
Note: See TracChangeset for help on using the changeset viewer.