diff --git a/core/lib/Drupal/Core/Cache/Cache.php b/core/lib/Drupal/Core/Cache/Cache.php
index da380995950af3fccc65dfb7d06ade503d6bfecb..71fbc0db2c928e9e570cac6fa4b7a4143fe93245 100644
--- a/core/lib/Drupal/Core/Cache/Cache.php
+++ b/core/lib/Drupal/Core/Cache/Cache.php
@@ -136,6 +136,11 @@ public static function getBins() {
    * call this function. Executing the query and formatting results should
    * happen in a #pre_render callback.
    *
+   * @deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. No
+   *   replacement provided.
+   *
+   * @see https://www.drupal.org/node/3308507
+   *
    * @param \Drupal\Core\Database\Query\SelectInterface $query
    *   A select query object.
    *
@@ -143,6 +148,7 @@ public static function getBins() {
    *   A hash of the query arguments.
    */
   public static function keyFromQuery(SelectInterface $query) {
+    @trigger_error(__METHOD__ . ' is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. No replacement provided. https://www.drupal.org/node/3322044', E_USER_DEPRECATED);
     $query->preExecute();
     $keys = [(string) $query, $query->getArguments()];
     return hash('sha256', serialize($keys));
diff --git a/core/tests/Drupal/Tests/Core/Cache/CacheTest.php b/core/tests/Drupal/Tests/Core/Cache/CacheTest.php
index 458eddcc99a1ecb7d221e29806f33c907520a09f..6b226965c971dff65697e79bf1fdc0413aea5773 100644
--- a/core/tests/Drupal/Tests/Core/Cache/CacheTest.php
+++ b/core/tests/Drupal/Tests/Core/Cache/CacheTest.php
@@ -3,6 +3,9 @@
 namespace Drupal\Tests\Core\Cache;
 
 use Drupal\Core\Cache\Cache;
+use Drupal\Tests\Core\Database\Stub\Select;
+use Drupal\Tests\Core\Database\Stub\StubConnection;
+use Drupal\Tests\Core\Database\Stub\StubPDO;
 use Drupal\Tests\UnitTestCase;
 use Prophecy\Argument;
 use Drupal\Core\Cache\Context\CacheContextsManager;
@@ -184,4 +187,14 @@ public function testBuildTags($prefix, array $suffixes, array $expected, $glue =
     $this->assertEquals($expected, Cache::buildTags($prefix, $suffixes, $glue));
   }
 
+  /**
+   * @covers ::keyFromQuery
+   * @group legacy
+   */
+  public function testKeyFromQuery() {
+    $this->expectDeprecation('Drupal\Core\Cache\Cache::keyFromQuery is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. No replacement provided. https://www.drupal.org/node/3322044');
+    $query = new Select(new StubConnection(new StubPDO(), []), 'dne');
+    Cache::keyFromQuery($query);
+  }
+
 }