aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Davis <jdavis@postgresql.org>2020-03-23 18:55:12 -0700
committerJeff Davis <jdavis@postgresql.org>2020-03-23 19:03:49 -0700
commit76df765e88fd9016e4b4f75dc69bcd9a1f335f72 (patch)
tree0cd15a4d0e82d1dd46fe00e1c95e3c0c1175a7d4
parent67e0adfb3f98f1e4a89a32b6f2e59774ce579146 (diff)
downloadpostgresql-76df765e88fd9016e4b4f75dc69bcd9a1f335f72.tar.gz
postgresql-76df765e88fd9016e4b4f75dc69bcd9a1f335f72.zip
Reduce test time for disk-based Hash Aggregation.
Discussion: https://postgr.es/m/23196.1584943506@sss.pgh.pa.us
-rw-r--r--src/test/regress/expected/aggregates.out30
-rw-r--r--src/test/regress/expected/groupingsets.out72
-rw-r--r--src/test/regress/sql/aggregates.sql24
-rw-r--r--src/test/regress/sql/groupingsets.sql69
4 files changed, 53 insertions, 142 deletions
diff --git a/src/test/regress/expected/aggregates.out b/src/test/regress/expected/aggregates.out
index 3259a22516e..14cdcfcca6e 100644
--- a/src/test/regress/expected/aggregates.out
+++ b/src/test/regress/expected/aggregates.out
@@ -2453,22 +2453,22 @@ set work_mem='64kB';
set enable_hashagg = false;
set jit_above_cost = 0;
explain (costs off)
-select g%100000 as c1, sum(g::numeric) as c2, count(*) as c3
- from generate_series(0, 199999) g
- group by g%100000;
+select g%10000 as c1, sum(g::numeric) as c2, count(*) as c3
+ from generate_series(0, 19999) g
+ group by g%10000;
QUERY PLAN
------------------------------------------------
GroupAggregate
- Group Key: ((g % 100000))
+ Group Key: ((g % 10000))
-> Sort
- Sort Key: ((g % 100000))
+ Sort Key: ((g % 10000))
-> Function Scan on generate_series g
(5 rows)
create table agg_group_1 as
-select g%100000 as c1, sum(g::numeric) as c2, count(*) as c3
- from generate_series(0, 199999) g
- group by g%100000;
+select g%10000 as c1, sum(g::numeric) as c2, count(*) as c3
+ from generate_series(0, 19999) g
+ group by g%10000;
create table agg_group_2 as
select * from
(values (100), (300), (500)) as r(a),
@@ -2493,20 +2493,20 @@ set enable_hashagg = true;
set enable_sort = false;
set jit_above_cost = 0;
explain (costs off)
-select g%100000 as c1, sum(g::numeric) as c2, count(*) as c3
- from generate_series(0, 199999) g
- group by g%100000;
+select g%10000 as c1, sum(g::numeric) as c2, count(*) as c3
+ from generate_series(0, 19999) g
+ group by g%10000;
QUERY PLAN
------------------------------------------
HashAggregate
- Group Key: (g % 100000)
+ Group Key: (g % 10000)
-> Function Scan on generate_series g
(3 rows)
create table agg_hash_1 as
-select g%100000 as c1, sum(g::numeric) as c2, count(*) as c3
- from generate_series(0, 199999) g
- group by g%100000;
+select g%10000 as c1, sum(g::numeric) as c2, count(*) as c3
+ from generate_series(0, 19999) g
+ group by g%10000;
create table agg_hash_2 as
select * from
(values (100), (300), (500)) as r(a),
diff --git a/src/test/regress/expected/groupingsets.out b/src/test/regress/expected/groupingsets.out
index dbe5140b558..05ff204f02c 100644
--- a/src/test/regress/expected/groupingsets.out
+++ b/src/test/regress/expected/groupingsets.out
@@ -1644,10 +1644,10 @@ SET work_mem='64kB';
set enable_hashagg = false;
set jit_above_cost = 0;
explain (costs off)
-select g1000, g100, g10, sum(g::numeric), count(*), max(g::text) from
+select g100, g10, sum(g::numeric), count(*), max(g::text) from
(select g%1000 as g1000, g%100 as g100, g%10 as g10, g
- from generate_series(0,199999) g) s
-group by cube (g1000,g100,g10);
+ from generate_series(0,1999) g) s
+group by cube (g1000, g100,g10);
QUERY PLAN
---------------------------------------------------------------
GroupAggregate
@@ -1667,31 +1667,18 @@ group by cube (g1000,g100,g10);
(14 rows)
create table gs_group_1 as
-select g1000, g100, g10, sum(g::numeric), count(*), max(g::text) from
+select g100, g10, sum(g::numeric), count(*), max(g::text) from
(select g%1000 as g1000, g%100 as g100, g%10 as g10, g
- from generate_series(0,199999) g) s
-group by cube (g1000,g100,g10);
-set jit_above_cost to default;
-create table gs_group_2 as
-select g1000, g100, g10, sum(g::numeric), count(*), max(g::text) from
- (select g/20 as g1000, g/200 as g100, g/2000 as g10, g
- from generate_series(0,19999) g) s
-group by cube (g1000,g100,g10);
-create table gs_group_3 as
-select g100, g10, array_agg(g) as a, count(*) as c, max(g::text) as m from
- (select g/200 as g100, g/2000 as g10, g
- from generate_series(0,19999) g) s
-group by grouping sets (g100,g10);
+ from generate_series(0,1999) g) s
+group by cube (g1000, g100,g10);
-- Produce results with hash aggregation.
set enable_hashagg = true;
set enable_sort = false;
-set work_mem='64kB';
-set jit_above_cost = 0;
explain (costs off)
-select g1000, g100, g10, sum(g::numeric), count(*), max(g::text) from
+select g100, g10, sum(g::numeric), count(*), max(g::text) from
(select g%1000 as g1000, g%100 as g100, g%10 as g10, g
- from generate_series(0,199999) g) s
-group by cube (g1000,g100,g10);
+ from generate_series(0,1999) g) s
+group by cube (g1000, g100,g10);
QUERY PLAN
---------------------------------------------------
MixedAggregate
@@ -1707,52 +1694,21 @@ group by cube (g1000,g100,g10);
(10 rows)
create table gs_hash_1 as
-select g1000, g100, g10, sum(g::numeric), count(*), max(g::text) from
+select g100, g10, sum(g::numeric), count(*), max(g::text) from
(select g%1000 as g1000, g%100 as g100, g%10 as g10, g
- from generate_series(0,199999) g) s
-group by cube (g1000,g100,g10);
-set jit_above_cost to default;
-create table gs_hash_2 as
-select g1000, g100, g10, sum(g::numeric), count(*), max(g::text) from
- (select g/20 as g1000, g/200 as g100, g/2000 as g10, g
- from generate_series(0,19999) g) s
-group by cube (g1000,g100,g10);
-create table gs_hash_3 as
-select g100, g10, array_agg(g) as a, count(*) as c, max(g::text) as m from
- (select g/200 as g100, g/2000 as g10, g
- from generate_series(0,19999) g) s
-group by grouping sets (g100,g10);
+ from generate_series(0,1999) g) s
+group by cube (g1000, g100,g10);
set enable_sort = true;
set work_mem to default;
-- Compare results
(select * from gs_hash_1 except select * from gs_group_1)
union all
(select * from gs_group_1 except select * from gs_hash_1);
- g1000 | g100 | g10 | sum | count | max
--------+------+-----+-----+-------+-----
-(0 rows)
-
-(select * from gs_hash_2 except select * from gs_group_2)
- union all
-(select * from gs_group_2 except select * from gs_hash_2);
- g1000 | g100 | g10 | sum | count | max
--------+------+-----+-----+-------+-----
-(0 rows)
-
-(select g100,g10,unnest(a),c,m from gs_hash_3 except
- select g100,g10,unnest(a),c,m from gs_group_3)
- union all
-(select g100,g10,unnest(a),c,m from gs_group_3 except
- select g100,g10,unnest(a),c,m from gs_hash_3);
- g100 | g10 | unnest | c | m
-------+-----+--------+---+---
+ g100 | g10 | sum | count | max
+------+-----+-----+-------+-----
(0 rows)
drop table gs_group_1;
-drop table gs_group_2;
-drop table gs_group_3;
drop table gs_hash_1;
-drop table gs_hash_2;
-drop table gs_hash_3;
SET enable_groupingsets_hash_disk TO DEFAULT;
-- end
diff --git a/src/test/regress/sql/aggregates.sql b/src/test/regress/sql/aggregates.sql
index 5da6f4152be..9480abd577e 100644
--- a/src/test/regress/sql/aggregates.sql
+++ b/src/test/regress/sql/aggregates.sql
@@ -1066,14 +1066,14 @@ set enable_hashagg = false;
set jit_above_cost = 0;
explain (costs off)
-select g%100000 as c1, sum(g::numeric) as c2, count(*) as c3
- from generate_series(0, 199999) g
- group by g%100000;
+select g%10000 as c1, sum(g::numeric) as c2, count(*) as c3
+ from generate_series(0, 19999) g
+ group by g%10000;
create table agg_group_1 as
-select g%100000 as c1, sum(g::numeric) as c2, count(*) as c3
- from generate_series(0, 199999) g
- group by g%100000;
+select g%10000 as c1, sum(g::numeric) as c2, count(*) as c3
+ from generate_series(0, 19999) g
+ group by g%10000;
create table agg_group_2 as
select * from
@@ -1106,14 +1106,14 @@ set enable_sort = false;
set jit_above_cost = 0;
explain (costs off)
-select g%100000 as c1, sum(g::numeric) as c2, count(*) as c3
- from generate_series(0, 199999) g
- group by g%100000;
+select g%10000 as c1, sum(g::numeric) as c2, count(*) as c3
+ from generate_series(0, 19999) g
+ group by g%10000;
create table agg_hash_1 as
-select g%100000 as c1, sum(g::numeric) as c2, count(*) as c3
- from generate_series(0, 199999) g
- group by g%100000;
+select g%10000 as c1, sum(g::numeric) as c2, count(*) as c3
+ from generate_series(0, 19999) g
+ group by g%10000;
create table agg_hash_2 as
select * from
diff --git a/src/test/regress/sql/groupingsets.sql b/src/test/regress/sql/groupingsets.sql
index 478f49ecab5..77e196798ac 100644
--- a/src/test/regress/sql/groupingsets.sql
+++ b/src/test/regress/sql/groupingsets.sql
@@ -453,68 +453,37 @@ SET work_mem='64kB';
-- Produce results with sorting.
set enable_hashagg = false;
-
set jit_above_cost = 0;
explain (costs off)
-select g1000, g100, g10, sum(g::numeric), count(*), max(g::text) from
+select g100, g10, sum(g::numeric), count(*), max(g::text) from
(select g%1000 as g1000, g%100 as g100, g%10 as g10, g
- from generate_series(0,199999) g) s
-group by cube (g1000,g100,g10);
+ from generate_series(0,1999) g) s
+group by cube (g1000, g100,g10);
create table gs_group_1 as
-select g1000, g100, g10, sum(g::numeric), count(*), max(g::text) from
+select g100, g10, sum(g::numeric), count(*), max(g::text) from
(select g%1000 as g1000, g%100 as g100, g%10 as g10, g
- from generate_series(0,199999) g) s
-group by cube (g1000,g100,g10);
-
-set jit_above_cost to default;
-
-create table gs_group_2 as
-select g1000, g100, g10, sum(g::numeric), count(*), max(g::text) from
- (select g/20 as g1000, g/200 as g100, g/2000 as g10, g
- from generate_series(0,19999) g) s
-group by cube (g1000,g100,g10);
-
-create table gs_group_3 as
-select g100, g10, array_agg(g) as a, count(*) as c, max(g::text) as m from
- (select g/200 as g100, g/2000 as g10, g
- from generate_series(0,19999) g) s
-group by grouping sets (g100,g10);
+ from generate_series(0,1999) g) s
+group by cube (g1000, g100,g10);
-- Produce results with hash aggregation.
set enable_hashagg = true;
set enable_sort = false;
-set work_mem='64kB';
-
-set jit_above_cost = 0;
explain (costs off)
-select g1000, g100, g10, sum(g::numeric), count(*), max(g::text) from
+select g100, g10, sum(g::numeric), count(*), max(g::text) from
(select g%1000 as g1000, g%100 as g100, g%10 as g10, g
- from generate_series(0,199999) g) s
-group by cube (g1000,g100,g10);
+ from generate_series(0,1999) g) s
+group by cube (g1000, g100,g10);
create table gs_hash_1 as
-select g1000, g100, g10, sum(g::numeric), count(*), max(g::text) from
+select g100, g10, sum(g::numeric), count(*), max(g::text) from
(select g%1000 as g1000, g%100 as g100, g%10 as g10, g
- from generate_series(0,199999) g) s
-group by cube (g1000,g100,g10);
+ from generate_series(0,1999) g) s
+group by cube (g1000, g100,g10);
-set jit_above_cost to default;
-
-create table gs_hash_2 as
-select g1000, g100, g10, sum(g::numeric), count(*), max(g::text) from
- (select g/20 as g1000, g/200 as g100, g/2000 as g10, g
- from generate_series(0,19999) g) s
-group by cube (g1000,g100,g10);
-
-create table gs_hash_3 as
-select g100, g10, array_agg(g) as a, count(*) as c, max(g::text) as m from
- (select g/200 as g100, g/2000 as g10, g
- from generate_series(0,19999) g) s
-group by grouping sets (g100,g10);
set enable_sort = true;
set work_mem to default;
@@ -525,22 +494,8 @@ set work_mem to default;
union all
(select * from gs_group_1 except select * from gs_hash_1);
-(select * from gs_hash_2 except select * from gs_group_2)
- union all
-(select * from gs_group_2 except select * from gs_hash_2);
-
-(select g100,g10,unnest(a),c,m from gs_hash_3 except
- select g100,g10,unnest(a),c,m from gs_group_3)
- union all
-(select g100,g10,unnest(a),c,m from gs_group_3 except
- select g100,g10,unnest(a),c,m from gs_hash_3);
-
drop table gs_group_1;
-drop table gs_group_2;
-drop table gs_group_3;
drop table gs_hash_1;
-drop table gs_hash_2;
-drop table gs_hash_3;
SET enable_groupingsets_hash_disk TO DEFAULT;