diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc
index 9f37dfc..59d29d5 100644
--- a/includes/bootstrap.inc
+++ b/includes/bootstrap.inc
@@ -2988,6 +2988,10 @@ class SchemaCache extends DrupalCacheArray {
     // Cache by request method.
     parent::__construct('schema:runtime:' . ($_SERVER['REQUEST_METHOD'] == 'GET'), 'cache');
   }
+  /**
+   * Whether the cache should be persisted.
+   */
+  protected $persistable;
 
   /**
    * Overrides DrupalCacheArray::resolveCacheMiss().
@@ -2995,12 +2999,25 @@ class SchemaCache extends DrupalCacheArray {
   protected function resolveCacheMiss($offset) {
     $complete_schema = drupal_get_complete_schema();
     $value = isset($complete_schema[$offset]) ? $complete_schema[$offset] :  NULL;
-    $this->storage[$offset] = $value;
-    $this->persist($offset);
+    if ($this->persistable() && !empty($complete_schema)) {
+      $this->storage[$offset] = $value;
+      $this->persist($offset);
+    }
     return $value;
   }
 }
 
+  /**
+   * Whether the cache should be persisted.
+   */
+  function persistable() {
+    // Try until we have reached full bootstrap level.
+    if (empty($this->persistable)) {
+      $this->persistable = drupal_get_bootstrap_phase() == DRUPAL_BOOTSTRAP_FULL;
+    }
+    return $this->persistable;
+  }
+
 /**
  * Gets the whole database schema.
  *
