*** /home/postgres/pgsql/src/test/regress/expected/stats_ext.out	Mon Feb 12 14:53:46 2018
--- /home/postgres/pgsql/src/test/regress/results/stats_ext.out	Fri Feb 16 11:23:11 2018
***************
*** 309,323 ****
           ->  Seq Scan on ndistinct
  (5 rows)
  
! EXPLAIN (COSTS off)
   SELECT COUNT(*) FROM ndistinct GROUP BY b, c, d;
!          QUERY PLAN          
! -----------------------------
!  HashAggregate
     Group Key: b, c, d
!    ->  Seq Scan on ndistinct
  (3 rows)
  
  EXPLAIN (COSTS off)
   SELECT COUNT(*) FROM ndistinct GROUP BY a, d;
           QUERY PLAN          
--- 309,336 ----
           ->  Seq Scan on ndistinct
  (5 rows)
  
! EXPLAIN --(COSTS off)
   SELECT COUNT(*) FROM ndistinct GROUP BY b, c, d;
!                               QUERY PLAN                              
! ----------------------------------------------------------------------
!  HashAggregate  (cost=291.00..307.32 rows=1632 width=20)
     Group Key: b, c, d
!    ->  Seq Scan on ndistinct  (cost=0.00..191.00 rows=10000 width=12)
  (3 rows)
  
+ set enable_hashagg = 0;
+ EXPLAIN --(COSTS off)
+  SELECT COUNT(*) FROM ndistinct GROUP BY b, c, d;
+                                  QUERY PLAN                                 
+ ----------------------------------------------------------------------------
+  GroupAggregate  (cost=1026.89..1168.21 rows=1632 width=20)
+    Group Key: b, c, d
+    ->  Sort  (cost=1026.89..1051.89 rows=10000 width=12)
+          Sort Key: b, c, d
+          ->  Seq Scan on ndistinct  (cost=0.00..191.00 rows=10000 width=12)
+ (5 rows)
+ 
+ reset enable_hashagg;
  EXPLAIN (COSTS off)
   SELECT COUNT(*) FROM ndistinct GROUP BY a, d;
           QUERY PLAN          

======================================================================

