Opened 10 months ago

#21435 new enhancement

wp-includes/comment.php line85 causes slow query due to the non-indexed column

Reported by: matsubobo Owned by:
Priority: normal Milestone: Awaiting Review
Component: General Version: 3.4.1
Severity: minor Keywords: has-patch
Cc:

Description

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.

http://matsu.teraren.com/blog/wp-content/uploads/2012/08/a40b1291fd99413dc3057fbe0b792a93.png

To fix this issue, I added index on my running wordpress and returns 0.00sec.

I'll attach the patch for create table file.

Attachments (1)

index.patch (511 bytes) - added by matsubobo 10 months ago.
patch for create table.

Download all attachments as: .zip

Change History (1)

patch for create table.

Note: See TracTickets for help on using tickets.