Index: modules/comment/comment.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.module,v
retrieving revision 1.822
diff -u -p -r1.822 comment.module
--- modules/comment/comment.module	26 Dec 2009 16:50:08 -0000	1.822
+++ modules/comment/comment.module	28 Dec 2009 08:55:10 -0000
@@ -1523,8 +1523,6 @@ class CommentController extends DrupalDe
   protected function buildQuery() {
     parent::buildQuery();
     // Specify additional fields from the user and node tables.
-    $this->query->innerJoin('node', 'n', 'base.nid = n.nid');
-    $this->query->addField('n', 'type', 'node_type');
     $this->query->innerJoin('users', 'u', 'base.uid = u.uid');
     $this->query->addField('u', 'name', 'registered_name');
     $this->query->fields('u', array('uid', 'signature', 'picture', 'data'));
@@ -1532,11 +1530,19 @@ class CommentController extends DrupalDe
 
   protected function attachLoad(&$comments) {
     // Setup standard comment properties.
+    // To avoid joining on the {node} table, get the node type from the node
+    // itself. node_load() will be statically cached nearly every time comments
+    // are loaded so this is usually cheaper than either a join or a separate
+    // query.
+    $comment = reset($comments);
+    if ($comment) {
+      $node = node_load($comment->nid);
+    }
     foreach ($comments as $key => $comment) {
       $comment = drupal_unpack($comment);
       $comment->name = $comment->uid ? $comment->registered_name : $comment->name;
       $comment->new = node_mark($comment->nid, $comment->changed);
-      $comment->node_type = 'comment_node_' . $comment->node_type;
+      $comment->node_type = 'comment_node_' . $node->type;
       $comments[$key] = $comment;
     }
     parent::attachLoad($comments);
