Accept plan changes in the aggregates regression suite
authorTomas Vondra <[email protected]>
Thu, 4 May 2017 16:22:36 +0000 (18:22 +0200)
committerTomas Vondra <[email protected]>
Thu, 4 May 2017 16:34:34 +0000 (18:34 +0200)
The expected plans were different for a number of simple reasons:

- missing list of data nodes in EXPLAIN output
- new upstream plan, missing Remote Subquery node
- MixMax queries using upstream plans after the merge

The first two issues were fixed by simply adding the missing pieces.

The third difference was resolved by reverting to XL 9.5 plans, with
a two minor tweaks. Firstly, upstream switched from HashAggregate
to Unique path for DISTINCT. Secondly, XL 9.6 uses the partial
aggregate infrastructure, so the plans use Partial / Finalize
Aggregate nodes.

src/test/regress/expected/aggregates.out

index 14242aea525507836a9c2248a93895eecc3c571c..47e4f38d75f19cf7467d37756d568edca1a59bc6 100644 (file)
@@ -599,7 +599,7 @@ explain (costs off)
  Result
    InitPlan 1 (returns $0)
      ->  Limit
-           ->  Remote Subquery Scan on all
+           ->  Remote Subquery Scan on all (datanode_1,datanode_2)
                  ->  Limit
                        ->  Index Only Scan Backward using tenk1_unique1 on tenk1
                              Index Cond: ((unique1 IS NOT NULL) AND (unique1 > 42000))
@@ -792,15 +792,17 @@ select max(unique2), generate_series(1,3) as g from tenk1 order by g desc;
 -- interesting corner case: constant gets optimized into a seqscan
 explain (costs off)
   select max(100) from tenk1;
-                     QUERY PLAN                     
-----------------------------------------------------
+                            QUERY PLAN                             
+-------------------------------------------------------------------
  Result
    InitPlan 1 (returns $0)
      ->  Limit
-           ->  Result
-                 One-Time Filter: (100 IS NOT NULL)
-                 ->  Seq Scan on tenk1
-(6 rows)
+           ->  Remote Subquery Scan on all (datanode_1,datanode_2)
+                 ->  Limit
+                       ->  Result
+                             One-Time Filter: (100 IS NOT NULL)
+                             ->  Seq Scan on tenk1
+(8 rows)
 
 select max(100) from tenk1;
  max 
@@ -823,32 +825,17 @@ insert into minmaxtest2 values(15), (16);
 insert into minmaxtest3 values(17), (18);
 explain (costs off, nodes off)
   select min(f1), max(f1) from minmaxtest;
-                                          QUERY PLAN                                          
-----------------------------------------------------------------------------------------------
- Result
-   InitPlan 1 (returns $0)
-     ->  Limit
-           ->  Merge Append
-                 Sort Key: minmaxtest.f1
-                 ->  Index Only Scan using minmaxtesti on minmaxtest
-                       Index Cond: (f1 IS NOT NULL)
-                 ->  Index Only Scan using minmaxtest1i on minmaxtest1
-                       Index Cond: (f1 IS NOT NULL)
-                 ->  Index Only Scan Backward using minmaxtest2i on minmaxtest2
-                       Index Cond: (f1 IS NOT NULL)
-                 ->  Index Only Scan using minmaxtest3i on minmaxtest3
-   InitPlan 2 (returns $1)
-     ->  Limit
-           ->  Merge Append
-                 Sort Key: minmaxtest_1.f1 DESC
-                 ->  Index Only Scan Backward using minmaxtesti on minmaxtest minmaxtest_1
-                       Index Cond: (f1 IS NOT NULL)
-                 ->  Index Only Scan Backward using minmaxtest1i on minmaxtest1 minmaxtest1_1
-                       Index Cond: (f1 IS NOT NULL)
-                 ->  Index Only Scan using minmaxtest2i on minmaxtest2 minmaxtest2_1
-                       Index Cond: (f1 IS NOT NULL)
-                 ->  Index Only Scan Backward using minmaxtest3i on minmaxtest3 minmaxtest3_1
-(23 rows)
+                   QUERY PLAN                    
+-------------------------------------------------
+ Finalize Aggregate
+   ->  Remote Subquery Scan on all
+         ->  Partial Aggregate
+               ->  Append
+                     ->  Seq Scan on minmaxtest
+                     ->  Seq Scan on minmaxtest1
+                     ->  Seq Scan on minmaxtest2
+                     ->  Seq Scan on minmaxtest3
+(8 rows)
 
 select min(f1), max(f1) from minmaxtest;
  min | max 
@@ -859,35 +846,20 @@ select min(f1), max(f1) from minmaxtest;
 -- DISTINCT doesn't do anything useful here, but it shouldn't fail
 explain (costs off)
   select distinct min(f1), max(f1) from minmaxtest;
-                                          QUERY PLAN                                          
-----------------------------------------------------------------------------------------------
+                              QUERY PLAN                               
+-----------------------------------------------------------------------
  Unique
-   InitPlan 1 (returns $0)
-     ->  Limit
-           ->  Merge Append
-                 Sort Key: minmaxtest.f1
-                 ->  Index Only Scan using minmaxtesti on minmaxtest
-                       Index Cond: (f1 IS NOT NULL)
-                 ->  Index Only Scan using minmaxtest1i on minmaxtest1
-                       Index Cond: (f1 IS NOT NULL)
-                 ->  Index Only Scan Backward using minmaxtest2i on minmaxtest2
-                       Index Cond: (f1 IS NOT NULL)
-                 ->  Index Only Scan using minmaxtest3i on minmaxtest3
-   InitPlan 2 (returns $1)
-     ->  Limit
-           ->  Merge Append
-                 Sort Key: minmaxtest_1.f1 DESC
-                 ->  Index Only Scan Backward using minmaxtesti on minmaxtest minmaxtest_1
-                       Index Cond: (f1 IS NOT NULL)
-                 ->  Index Only Scan Backward using minmaxtest1i on minmaxtest1 minmaxtest1_1
-                       Index Cond: (f1 IS NOT NULL)
-                 ->  Index Only Scan using minmaxtest2i on minmaxtest2 minmaxtest2_1
-                       Index Cond: (f1 IS NOT NULL)
-                 ->  Index Only Scan Backward using minmaxtest3i on minmaxtest3 minmaxtest3_1
    ->  Sort
-         Sort Key: ($0), ($1)
-         ->  Result
-(26 rows)
+         Sort Key: (min(f1)), (max(f1))
+         ->  Finalize Aggregate
+               ->  Remote Subquery Scan on all (datanode_1,datanode_2)
+                     ->  Partial Aggregate
+                           ->  Append
+                                 ->  Seq Scan on minmaxtest
+                                 ->  Seq Scan on minmaxtest1
+                                 ->  Seq Scan on minmaxtest2
+                                 ->  Seq Scan on minmaxtest3
+(11 rows)
 
 select distinct min(f1), max(f1) from minmaxtest;
  min | max 
@@ -1759,7 +1731,6 @@ SELECT var_samp(q1) FROM int8_tbl_aggtest;
 (1 row)
 
 DROP TABLE int8_tbl_aggtest;
-
 -- test aggregates with common transition functions share the same states
 begin work;
 create type avg_state as (total bigint, count bigint);