Add an index to the field comment_type
This index improves the response time of the query used by WC_Comments::wp_count_comments() to get the number of comments by type.
This commit is contained in:
parent
ab721f2d4a
commit
2e8f02f6a4
|
@ -403,6 +403,10 @@ class WC_Install {
|
|||
}
|
||||
|
||||
dbDelta( self::get_schema() );
|
||||
|
||||
// Add an index to the field comment_type to improve the response time of the query
|
||||
// used by WC_Comments::wp_count_comments() to get the number of comments by type.
|
||||
$wpdb->query( "ALTER TABLE {$wpdb->comments} ADD INDEX woo_idx_comment_type (comment_type)" );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -987,3 +987,15 @@ function wc_update_270_webhooks() {
|
|||
$webhook->set_topic( 'product.updated' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an index to the field comment_type to improve the response time of the query
|
||||
* used by WC_Comments::wp_count_comments() to get the number of comments by type.
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
function wc_update_270_comment_type_index() {
|
||||
global $wpdb;
|
||||
|
||||
$wpdb->query( "ALTER TABLE {$wpdb->comments} ADD INDEX woo_idx_comment_type (comment_type)" );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue