Opened 17 months ago
wp-includes/comment.php line85 causes slow query due to the non-indexed column
|Reported by:||matsubobo||Owned by:|
Following query is causes slow query if the wp_comment table is huge.
$ok_to_comment = $wpdb->get_var("SELECT comment_approved FROM $wpdb->comments WHERE comment_author = '$author' AND comment_author_email = '$email' and comment_approved = '1' LIMIT 1");
In my case, I have 600 thousand records in the wp_comments table and the query takes over 10 minutes to complete.
To fix this issue, I added index on my running wordpress and returns 0.00sec.
I'll attach the patch for create table file.