wp-includes/comment.php line85 causes slow query due to the non-indexed column
|Reported by:||matsubobo||Owned by:||pento|
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.
Change History (22)
- Component changed from General to Database
- Milestone changed from Awaiting Review to Future Release
- Owner set to pento
- Status changed from new to assigned
- Keywords commit added
- Milestone changed from Future Release to 3.9