diff --git a/core/lib/Drupal/Core/Database/Query/Insert.php b/core/lib/Drupal/Core/Database/Query/Insert.php
index 045413a..c2e9c1c 100644
--- a/core/lib/Drupal/Core/Database/Query/Insert.php
+++ b/core/lib/Drupal/Core/Database/Query/Insert.php
@@ -14,7 +14,7 @@
  *
  * @ingroup database
  */
-class Insert extends Query {
+class Insert extends Query implements \Countable {
 
   use InsertTrait;
 
@@ -175,4 +175,12 @@ protected function preExecute() {
     }
     return TRUE;
   }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function count() {
+    return count($this->insertValues);
+  }
+
 }
diff --git a/core/lib/Drupal/Core/Database/Query/Upsert.php b/core/lib/Drupal/Core/Database/Query/Upsert.php
index e9b5d0e..b8d6a37 100644
--- a/core/lib/Drupal/Core/Database/Query/Upsert.php
+++ b/core/lib/Drupal/Core/Database/Query/Upsert.php
@@ -18,7 +18,7 @@
  * Insert except the rows will be set to the desired values even if the key
  * existed before.
  */
-abstract class Upsert extends Query {
+abstract class Upsert extends Query implements \Countable {
 
   use InsertTrait;
 
@@ -116,4 +116,11 @@ public function execute() {
     return $last_insert_id;
   }
 
+  /**
+   * {@inheritdoc}
+   */
+  public function count() {
+    return count($this->insertValues);
+  }
+
 }
