diff --git a/core/lib/Drupal/Core/Database/Driver/pgsql/Schema.php b/core/lib/Drupal/Core/Database/Driver/pgsql/Schema.php
index 106add49efb010b52ee2ff83765b1c183ef3c2bf..afb7f604fbde93cef919a9d5988655b5835cd5c5 100644
--- a/core/lib/Drupal/Core/Database/Driver/pgsql/Schema.php
+++ b/core/lib/Drupal/Core/Database/Driver/pgsql/Schema.php
@@ -1060,6 +1060,23 @@ protected function hashBase64($data) {
     return strtr($hash, ['+' => '_', '/' => '_', '=' => '']);
   }
 
+  /**
+   * Determines whether the PostgreSQL extension is created.
+   *
+   * @param string $name
+   *   The name of the extension.
+   *
+   * @return bool
+   *   Return TRUE when the extension is created, FALSE otherwise.
+   *
+   * @internal
+   */
+  public function extensionExists($name): bool {
+    return (bool) $this->connection->query('SELECT installed_version FROM pg_available_extensions WHERE name = :name', [
+      ':name' => $name,
+    ])->fetchField();
+  }
+
 }
 
 /**
diff --git a/core/modules/system/system.install b/core/modules/system/system.install
index e19a96853d9375b739bf1a385e16cca406c837a4..6eae0bb05095cedf6b1958f930132c4d5fd6b875 100644
--- a/core/modules/system/system.install
+++ b/core/modules/system/system.install
@@ -472,6 +472,21 @@ function system_requirements($phase) {
     }
   }
 
+  // Test with PostgreSQL databases for the status of the pg_trgm extension.
+  if ($phase === 'runtime') {
+    if (Database::isActiveConnection() && (Database::getConnection()->driver() == 'pgsql') && !Database::getConnection()->schema()->extensionExists('pg_trgm')) {
+      $requirements['pgsql_extension_pg_trgm'] = [
+        'severity' => REQUIREMENT_WARNING,
+        'title' => t('PostgreSQL pg_trgm extension'),
+        'value' => t('Not created'),
+        'description' => t('The <a href=":pg_trgm">pg_trgm</a> PostgreSQL extension is not present. The extension will be required by Drupal 10 to improve performance when using PostgreSQL. See <a href=":requirements">Drupal database server requirements</a> for more information.', [
+          ':pg_trgm' => 'https://www.postgresql.org/docs/current/pgtrgm.html',
+          ':requirements' => 'https://www.drupal.org/docs/system-requirements/database-server-requirements',
+        ]),
+      ];
+    }
+  }
+
   // Test PHP memory_limit
   $memory_limit = ini_get('memory_limit');
   $requirements['php_memory_limit'] = [
diff --git a/core/tests/Drupal/KernelTests/Core/Database/SchemaTest.php b/core/tests/Drupal/KernelTests/Core/Database/SchemaTest.php
index da8578bc738613ede9596fb7b7f0bf6208f292b1..039e916a33abc9592a13381ea1059dc21b574826 100644
--- a/core/tests/Drupal/KernelTests/Core/Database/SchemaTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Database/SchemaTest.php
@@ -1347,4 +1347,19 @@ public function testDefaultAfterAlter() {
     $this->assertSame('default value', $result->column7);
   }
 
+  /**
+   * @covers \Drupal\Core\Database\Driver\pgsql\Schema::extensionExists
+   */
+  public function testPgsqlExtensionExists() {
+    if ($this->connection->databaseType() !== 'pgsql') {
+      $this->markTestSkipped("This test only runs for PostgreSQL.");
+    }
+
+    // Test the method for a non existing extension.
+    $this->assertFalse($this->schema->extensionExists('non_existing_extension'));
+
+    // Test the method for an existing extension.
+    $this->assertTrue($this->schema->extensionExists('pg_trgm'));
+  }
+
 }