diff --git src/wp-includes/user.php src/wp-includes/user.php
index 9a685b9b36..82ad168063 100644
--- src/wp-includes/user.php
+++ src/wp-includes/user.php
@@ -381,7 +381,13 @@ function count_user_posts( $userid, $post_type = 'post', $public_only = false )
 
 	$where = get_posts_by_author_sql( $post_type, true, $userid, $public_only );
 
-	$count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts $where" );
+	$cache_key = "count_user_posts_$userid";
+	$count     = wp_cache_get( $cache_key, 'user_posts_count' );
+
+	if ( false === $count ) {
+		$count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts $where" );
+		wp_cache_add( $cache_key, $count, 'user_posts_count', 5 * MINUTE_IN_SECONDS );
+	}
 
 	/**
 	 * Filters the number of posts a user has written.
@@ -418,12 +424,8 @@ function count_many_users_posts( $users, $post_type = 'post', $public_only = fal
 		return $count;
 	}
 
-	$userlist = implode( ',', array_map( 'absint', $users ) );
-	$where    = get_posts_by_author_sql( $post_type, true, null, $public_only );
-
-	$result = $wpdb->get_results( "SELECT post_author, COUNT(*) FROM $wpdb->posts $where AND post_author IN ($userlist) GROUP BY post_author", ARRAY_N );
-	foreach ( $result as $row ) {
-		$count[ $row[0] ] = $row[1];
+	foreach ( $users as $user_id ) {
+		$count[ $user_id ] = count_user_posts( $user_id, $post_type, $public_only );
 	}
 
 	foreach ( $users as $id ) {
