Index: modules/comment/comment.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.module,v
retrieving revision 1.866
diff -u -p -r1.866 comment.module
--- modules/comment/comment.module	13 Apr 2010 23:12:26 -0000	1.866
+++ modules/comment/comment.module	15 Apr 2010 12:57:57 -0000
@@ -1243,16 +1243,20 @@ function comment_node_prepare($node) {
  * Implements hook_node_insert().
  */
 function comment_node_insert($node) {
-  db_insert('node_comment_statistics')
-    ->fields(array(
-      'nid' => $node->nid,
-      'cid' => 0,
-      'last_comment_timestamp' => $node->changed,
-      'last_comment_name' => NULL,
-      'last_comment_uid' => $node->uid,
-      'comment_count' => 0,
-    ))
-    ->execute();
+  // Set this variable to FALSE to disable updates to the
+  // {node_comment_statistics} table temporarily, such as during a migration.
+  if (variable_get('comment_maintain_node_statistics', TRUE)) {
+    db_insert('node_comment_statistics')
+      ->fields(array(
+        'nid' => $node->nid,
+        'cid' => 0,
+        'last_comment_timestamp' => $node->changed,
+        'last_comment_name' => NULL,
+        'last_comment_uid' => $node->uid,
+        'comment_count' => 0,
+      ))
+      ->execute();
+  }
 }
 
 /**
