diff --git a/core/modules/node/src/Plugin/Search/NodeSearch.php b/core/modules/node/src/Plugin/Search/NodeSearch.php
index 83140c1..985a140 100644
--- a/core/modules/node/src/Plugin/Search/NodeSearch.php
+++ b/core/modules/node/src/Plugin/Search/NodeSearch.php
@@ -206,8 +206,8 @@ protected function findResults() {
     // Build matching conditions.
     $query = $this->database
       ->select('search_index', 'i', array('target' => 'replica'))
-      ->extend('Drupal\search\SearchQuery')
-      ->extend('Drupal\Core\Database\Query\PagerSelectExtender');
+      ->extend('Drupal\Core\Database\Query\PagerSelectExtender')
+      ->extend('Drupal\search\SearchQuery');
     $query->join('node_field_data', 'n', 'n.nid = i.sid');
     $query->condition('n.status', 1)
       ->addTag('node_access')
diff --git a/core/modules/search/src/SearchQuery.php b/core/modules/search/src/SearchQuery.php
index de679c2..21c271b 100644
--- a/core/modules/search/src/SearchQuery.php
+++ b/core/modules/search/src/SearchQuery.php
@@ -606,8 +606,6 @@ public function countQuery() {
     if (count($this->conditions)) {
       $inner->condition($this->conditions);
     }
-    // PostgreSQL requires a group by condition to prevent a GROUPING ERROR.
-    $inner->groupBy('i.sid');
 
     // Remove existing fields and expressions, they are not needed for a count
     // query.
