diff --git a/modules/taxonomy/taxonomy.install b/modules/taxonomy/taxonomy.install
index e3603e1..67de111 100644
--- a/modules/taxonomy/taxonomy.install
+++ b/modules/taxonomy/taxonomy.install
@@ -557,7 +557,7 @@ function taxonomy_update_7005(&$sandbox) {
   // of term references stored so far for the current revision, which
   // provides the delta value for each term reference data insert. The
   // deltas are reset for each new revision.
-  
+
   $conditions = array(
     'type' => 'taxonomy_term_reference',
     'deleted' => 0,
@@ -903,13 +903,46 @@ function taxonomy_update_7010() {
 /**
  * Drop unpublished nodes from the index.
  */
-function taxonomy_update_7011() {
-  $nids = db_query('SELECT nid from {node} WHERE status = :status', array(':status' => NODE_NOT_PUBLISHED))->fetchCol();
-  if (!empty($nids)) {
-    db_delete('taxonomy_index')
-      ->condition('nid', $nids)
-      ->execute();
+function taxonomy_update_7011(&$sandbox) {
+  // Process records in groups of 5000.
+  $limit = 5000;
+
+  // Use the sandbox at your convenience to store the information needed
+  // to track progression between successive calls to the function.
+  if (!isset($sandbox['progress'])) {
+    // The count of nodes processed so far.
+    $sandbox['progress'] = 0;
+
+    // Total records that must be visited.
+    $sandbox['max'] = db_query('SELECT COUNT(n.nid) FROM node AS n INNER JOIN taxonomy_index AS t ON n.nid = t.nid WHERE n.status = :status', array(':status' => NODE_NOT_PUBLISHED))->fetchField();
+
+    // If there's no data, don't bother with the extra work.
+    if (empty($sandbox['max'])) {
+      return;
+    }
+    // A place to store messages during the run.
+    $sandbox['messages'] = array();
   }
+
+  // Preform work
+  if ($sandbox['progress'] < $sandbox['max']) {
+    // Get a slice of all records affected.
+    $nids = db_query('SELECT n.nid FROM node AS n INNER JOIN taxonomy_index AS t ON n.nid = t.nid WHERE n.status = :status LIMIT ' . $sandbox['progress'] . ', ' . $limit, array(
+      ':status' => NODE_NOT_PUBLISHED,
+    ))->fetchCol();
+
+    if (!empty($nids)) {
+      db_delete('taxonomy_index')
+        ->condition('nid', $nids)
+        ->execute();
+    }
+    $sandbox['progress'] += $limit;
+  }
+
+  // Set the "finished" status, to tell batch engine whether this function
+  // needs to run again. If you set a float, this will indicate the progress of
+  // the batch so the progress bar will update.
+  $sandbox['#finished'] = ($sandbox['progress'] >= $sandbox['max']) ? TRUE : ($sandbox['progress'] / $sandbox['max']);
 }
 
 /**
