Re: [HACKERS] Hash support for grouping sets - Mailing list pgsql-hackers

From Mark Dilger
Subject Re: [HACKERS] Hash support for grouping sets
Date
Msg-id 20170307214332.10866.34332.pgcf@coridan.postgresql.org
Whole thread Raw
In response to Re: [HACKERS] Hash support for grouping sets  (Andrew Gierth <andrew@tao11.riddles.org.uk>)
Responses Re: [HACKERS] Hash support for grouping sets  (Mark Dilger <hornschnorter@gmail.com>)
Re: [HACKERS] Hash support for grouping sets  (Andrew Gierth <andrew@tao11.riddles.org.uk>)
List pgsql-hackers
The following review has been posted through the commitfest application:
make installcheck-world:  tested, failed
Implements feature:       not tested
Spec compliant:           not tested
Documentation:            not tested

On my MacBook, `make check-world` gives differences in the contrib modules:

cat contrib/postgres_fdw/regression.diffs
*** /Users/mark/hydra/postgresql.review/contrib/postgres_fdw/expected/postgres_fdw.out    2017-03-03 13:33:47.000000000
-0800
--- /Users/mark/hydra/postgresql.review/contrib/postgres_fdw/results/postgres_fdw.out    2017-03-07 13:27:56.000000000
-0800
***************
*** 3148,3163 **** -- Grouping sets explain (verbose, costs off) select c2, sum(c1) from ft1 where c2 < 3 group by
rollup(c2)order by 1 nulls last;
 
!                                             QUERY PLAN                                             
! ---------------------------------------------------------------------------------------------------
!  GroupAggregate
!    Output: c2, sum(c1)
!    Group Key: ft1.c2
!    Group Key: ()
!    ->  Foreign Scan on public.ft1
!          Output: c2, c1
!          Remote SQL: SELECT "C 1", c2 FROM "S 1"."T 1" WHERE ((c2 < 3)) ORDER BY c2 ASC NULLS LAST
! (7 rows)  select c2, sum(c1) from ft1 where c2 < 3 group by rollup(c2) order by 1 nulls last;  c2 |  sum   
--- 3148,3166 ---- -- Grouping sets explain (verbose, costs off) select c2, sum(c1) from ft1 where c2 < 3 group by
rollup(c2)order by 1 nulls last;
 
!                                   QUERY PLAN                                  
! ------------------------------------------------------------------------------
!  Sort
!    Output: c2, (sum(c1))
!    Sort Key: ft1.c2
!    ->  MixedAggregate
!          Output: c2, sum(c1)
!          Hash Key: ft1.c2
!          Group Key: ()
!          ->  Foreign Scan on public.ft1
!                Output: c2, c1
!                Remote SQL: SELECT "C 1", c2 FROM "S 1"."T 1" WHERE ((c2 < 3))
! (10 rows)  select c2, sum(c1) from ft1 where c2 < 3 group by rollup(c2) order by 1 nulls last;  c2 |  sum   
***************
*** 3170,3185 ****  explain (verbose, costs off) select c2, sum(c1) from ft1 where c2 < 3 group by cube(c2) order by 1
nullslast;
 
!                                             QUERY PLAN                                             
! ---------------------------------------------------------------------------------------------------
!  GroupAggregate
!    Output: c2, sum(c1)
!    Group Key: ft1.c2
!    Group Key: ()
!    ->  Foreign Scan on public.ft1
!          Output: c2, c1
!          Remote SQL: SELECT "C 1", c2 FROM "S 1"."T 1" WHERE ((c2 < 3)) ORDER BY c2 ASC NULLS LAST
! (7 rows)  select c2, sum(c1) from ft1 where c2 < 3 group by cube(c2) order by 1 nulls last;  c2 |  sum   
--- 3173,3191 ----  explain (verbose, costs off) select c2, sum(c1) from ft1 where c2 < 3 group by cube(c2) order by 1
nullslast;
 
!                                   QUERY PLAN                                  
! ------------------------------------------------------------------------------
!  Sort
!    Output: c2, (sum(c1))
!    Sort Key: ft1.c2
!    ->  MixedAggregate
!          Output: c2, sum(c1)
!          Hash Key: ft1.c2
!          Group Key: ()
!          ->  Foreign Scan on public.ft1
!                Output: c2, c1
!                Remote SQL: SELECT "C 1", c2 FROM "S 1"."T 1" WHERE ((c2 < 3))
! (10 rows)  select c2, sum(c1) from ft1 where c2 < 3 group by cube(c2) order by 1 nulls last;  c2 |  sum   
***************
*** 3192,3211 ****  explain (verbose, costs off) select c2, c6, sum(c1) from ft1 where c2 < 3 group by grouping
sets(c2,c6) order by 1 nulls last, 2 nulls last;
 
!                                                  QUERY PLAN                                                  
! -------------------------------------------------------------------------------------------------------------  Sort
Output: c2, c6, (sum(c1))    Sort Key: ft1.c2, ft1.c6
 
!    ->  GroupAggregate          Output: c2, c6, sum(c1)
!          Group Key: ft1.c2
!          Sort Key: ft1.c6
!            Group Key: ft1.c6          ->  Foreign Scan on public.ft1                Output: c2, c6, c1
!                Remote SQL: SELECT "C 1", c2, c6 FROM "S 1"."T 1" WHERE ((c2 < 3)) ORDER BY c2 ASC NULLS LAST
! (11 rows)  select c2, c6, sum(c1) from ft1 where c2 < 3 group by grouping sets(c2, c6) order by 1 nulls last, 2 nulls
last; c2 | c6 |  sum  
 
--- 3198,3216 ----  explain (verbose, costs off) select c2, c6, sum(c1) from ft1 where c2 < 3 group by grouping
sets(c2,c6) order by 1 nulls last, 2 nulls last;
 
!                                     QUERY PLAN                                    
! ----------------------------------------------------------------------------------  Sort    Output: c2, c6, (sum(c1))
  Sort Key: ft1.c2, ft1.c6
 
!    ->  HashAggregate          Output: c2, c6, sum(c1)
!          Hash Key: ft1.c2
!          Hash Key: ft1.c6          ->  Foreign Scan on public.ft1                Output: c2, c6, c1
!                Remote SQL: SELECT "C 1", c2, c6 FROM "S 1"."T 1" WHERE ((c2 < 3))
! (10 rows)  select c2, c6, sum(c1) from ft1 where c2 < 3 group by grouping sets(c2, c6) order by 1 nulls last, 2 nulls
last; c2 | c6 |  sum  
 

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


pgsql-hackers by date:

Previous
From: "Sven R. Kunze"
Date:
Subject: Re: [HACKERS] SQL/JSON in PostgreSQL
Next
From: Mark Dilger
Date:
Subject: Re: [HACKERS] Hash support for grouping sets