Index: modules/comment/comment.install =================================================================== RCS file: /cvs/drupal/drupal/modules/comment/comment.install,v retrieving revision 1.60 diff -u -p -r1.60 comment.install --- modules/comment/comment.install 3 Feb 2010 18:16:23 -0000 1.60 +++ modules/comment/comment.install 12 Feb 2010 17:37:58 -0000 @@ -352,6 +352,13 @@ function comment_update_7013(&$sandbox) } /** + * Add an index to comment for comment_new_page_count(). + */ +function comment_update_7014() { + db_add_index('comment', 'comment_new_page_count', array('nid', 'status', 'created', 'cid', 'thread')); +} + +/** * @} End of "defgroup updates-6.x-to-7.x" * The next series of updates should start at 8000. */ @@ -457,6 +464,7 @@ function comment_schema() { 'comment_num_new' => array('nid', 'changed', 'status'), 'comment_uid' => array('uid'), 'comment_nid_language' => array('nid', 'language'), + 'comment_new_page_count' => array('nid', 'status', 'created', 'cid', 'thread'), ), 'primary key' => array('cid'), 'foreign keys' => array( Index: modules/comment/comment.module =================================================================== RCS file: /cvs/drupal/drupal/modules/comment/comment.module,v retrieving revision 1.842 diff -u -p -r1.842 comment.module --- modules/comment/comment.module 11 Feb 2010 15:52:12 -0000 1.842 +++ modules/comment/comment.module 12 Feb 2010 17:38:06 -0000 @@ -523,7 +523,8 @@ function comment_new_page_count($num_com ->fields('comment', array('thread')) ->condition('nid', $node->nid) ->condition('status', COMMENT_PUBLISHED) - ->orderBy('changed', 'DESC') + ->orderBy('created', 'DESC') + ->orderBy('cid', 'DESC') ->range(0, $new_replies); // 2. Find the first thread.