Issue #336483 by brianV, catch: Fixed Performance: SELECT MAX(comment_count()) FROM node_comment_statistics() does full table scan.

merge-requests/26/head
webchick 2012-02-01 09:12:19 -08:00
parent df99795a5d
commit 4c8c6eefb8
1 changed files with 5 additions and 2 deletions

View File

@ -226,8 +226,11 @@ function comment_update_7004() {
));
db_add_index('node_comment_statistics', 'cid', array('cid'));
// Add an index on the comment_count.
db_add_index('node_comment_statistics', 'comment_count', array('comment_count'));
// The comment_count index may have been added in Drupal 6.
if (!db_index_exists('node_comment_statistics', 'comment_count')) {
// Add an index on the comment_count.
db_add_index('node_comment_statistics', 'comment_count', array('comment_count'));
}
}
/**