diff --git a/core/lib/Drupal/Core/Database/Connection.php b/core/lib/Drupal/Core/Database/Connection.php
index 18283ce..a168f77 100644
--- a/core/lib/Drupal/Core/Database/Connection.php
+++ b/core/lib/Drupal/Core/Database/Connection.php
@@ -7,6 +7,8 @@
 
 namespace Drupal\Core\Database;
 
+use Drupal\Core\Database\Query\PlaceholderInterface;
+
 /**
  * Base Database API class.
  *
@@ -146,6 +148,13 @@
   protected $unprefixedTablesMap = [];
 
   /**
+   * The placeholder counter.
+   *
+   * @var array
+   */
+  protected $nextPlaceholder = [];
+
+  /**
    * Constructs a Connection object.
    *
    * @param \PDO $connection
@@ -1409,6 +1418,27 @@ public function quote($string, $parameter_type = \PDO::PARAM_STR) {
   }
 
   /**
+   * Returns the next placeholder ID for a query object.
+   *
+   * @param \Drupal\Core\Database\Query\PlaceholderInterface $object
+   *   An object implementing \Drupal\Core\Database\Query\PlaceholderInterface.
+   *
+   * @return int
+   *   The next placeholder ID.
+   */
+  public function getNextPlaceholder(PlaceholderInterface $object) {
+    $hash = spl_object_hash($object);
+    if (!isset($this->nextPlaceholder[$hash])) {
+      $this->nextPlaceholder[$hash] = 0;
+    }
+    else {
+      $this->nextPlaceholder[$hash]++;
+    }
+
+    return $this->nextPlaceholder[$hash];
+  }
+
+  /**
    * Prevents the database connection from being serialized.
    */
   public function __sleep() {
diff --git a/core/lib/Drupal/Core/Database/Query/Condition.php b/core/lib/Drupal/Core/Database/Query/Condition.php
index 4bb1d09..3ca69db 100644
--- a/core/lib/Drupal/Core/Database/Query/Condition.php
+++ b/core/lib/Drupal/Core/Database/Query/Condition.php
@@ -211,7 +211,7 @@ public function compile(Connection $connection, PlaceholderInterface $queryPlace
             }
             if ($operator['use_value']) {
               foreach ($condition['value'] as $value) {
-                $placeholder = ':db_condition_placeholder_' . $queryPlaceholder->nextPlaceholder();
+                $placeholder = ':db_condition_placeholder_' . $queryPlaceholder->nextPlaceholder($connection);
                 $arguments[$placeholder] = $value;
                 $placeholders[] = $placeholder;
               }
diff --git a/core/lib/Drupal/Core/Database/Query/Query.php b/core/lib/Drupal/Core/Database/Query/Query.php
index 8dba91b..1afac82 100644
--- a/core/lib/Drupal/Core/Database/Query/Query.php
+++ b/core/lib/Drupal/Core/Database/Query/Query.php
@@ -52,11 +52,6 @@
   protected $uniqueIdentifier;
 
   /**
-   * The placeholder counter.
-   */
-  protected $nextPlaceholder = 0;
-
-  /**
    * An array of comments that can be prepended to a query.
    *
    * @var array
@@ -131,13 +126,10 @@ public function uniqueIdentifier() {
   }
 
   /**
-   * Gets the next placeholder value for this query object.
-   *
-   * @return int
-   *   The next placeholder value.
+   * {@inheritdoc}
    */
   public function nextPlaceholder() {
-    return $this->nextPlaceholder++;
+    return $this->connection->getNextPlaceholder($this);
   }
 
   /**
diff --git a/core/lib/Drupal/Core/Database/Query/SelectExtender.php b/core/lib/Drupal/Core/Database/Query/SelectExtender.php
index cca68c7..0da7f1b 100644
--- a/core/lib/Drupal/Core/Database/Query/SelectExtender.php
+++ b/core/lib/Drupal/Core/Database/Query/SelectExtender.php
@@ -33,11 +33,6 @@ class SelectExtender implements SelectInterface {
    */
   protected $uniqueIdentifier;
 
-  /**
-   * The placeholder counter.
-   */
-  protected $placeholder = 0;
-
   public function __construct(SelectInterface $query, Connection $connection) {
     $this->uniqueIdentifier = uniqid('', TRUE);
     $this->query = $query;
@@ -52,10 +47,10 @@ public function uniqueIdentifier() {
   }
 
   /**
-   * Implements Drupal\Core\Database\Query\PlaceholderInterface::nextPlaceholder().
+   * {@inheritdoc}
    */
   public function nextPlaceholder() {
-    return $this->placeholder++;
+    return $this->connection->getNextPlaceholder($this);
   }
 
   /* Implementations of Drupal\Core\Database\Query\AlterableInterface. */
diff --git a/core/lib/Drupal/Core/Database/Schema.php b/core/lib/Drupal/Core/Database/Schema.php
index bd65330..adfb0c6 100644
--- a/core/lib/Drupal/Core/Database/Schema.php
+++ b/core/lib/Drupal/Core/Database/Schema.php
@@ -24,11 +24,6 @@
   protected $connection;
 
   /**
-   * The placeholder counter.
-   */
-  protected $placeholder = 0;
-
-  /**
    * Definition of prefixInfo array structure.
    *
    * Rather than redefining DatabaseSchema::getPrefixInfo() for each driver,
@@ -64,10 +59,10 @@ public function uniqueIdentifier() {
   }
 
   /**
-   * Implements PlaceHolderInterface::nextPlaceholder().
+   * {@inheritdoc}
    */
   public function nextPlaceholder() {
-    return $this->placeholder++;
+    return $this->connection->getNextPlaceholder($this);
   }
 
   /**
diff --git a/core/lib/Drupal/Core/Entity/Query/Sql/ConditionAggregate.php b/core/lib/Drupal/Core/Entity/Query/Sql/ConditionAggregate.php
index 9db67ea..3fb3d6e 100644
--- a/core/lib/Drupal/Core/Entity/Query/Sql/ConditionAggregate.php
+++ b/core/lib/Drupal/Core/Entity/Query/Sql/ConditionAggregate.php
@@ -43,7 +43,7 @@ public function compile($conditionContainer) {
         $condition_class = QueryBase::getClass($this->namespaces, 'Condition');
         $condition_class::translateCondition($condition, $sql_query, $tables->isFieldCaseSensitive($condition['field']));
         $function = $condition['function'];
-        $placeholder = ':db_placeholder_' . $conditionContainer->nextPlaceholder();
+        $placeholder = ':db_placeholder_' . $conditionContainer->nextPlaceholder($this->conn);
         $conditionContainer->having("$function($field) {$condition['operator']} $placeholder", array($placeholder => $condition['value']));
       }
     }
