Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
76df765e
Commit
76df765e
authored
Mar 23, 2020
by
Jeff Davis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reduce test time for disk-based Hash Aggregation.
Discussion:
https://postgr.es/m/23196.1584943506@sss.pgh.pa.us
parent
67e0adfb
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
53 additions
and
142 deletions
+53
-142
src/test/regress/expected/aggregates.out
src/test/regress/expected/aggregates.out
+15
-15
src/test/regress/expected/groupingsets.out
src/test/regress/expected/groupingsets.out
+14
-58
src/test/regress/sql/aggregates.sql
src/test/regress/sql/aggregates.sql
+12
-12
src/test/regress/sql/groupingsets.sql
src/test/regress/sql/groupingsets.sql
+12
-57
No files found.
src/test/regress/expected/aggregates.out
View file @
76df765e
...
...
@@ -2453,22 +2453,22 @@ set work_mem='64kB';
set enable_hashagg = false;
set jit_above_cost = 0;
explain (costs off)
select g%10000
0
as c1, sum(g::numeric) as c2, count(*) as c3
from generate_series(0, 19999
9
) g
group by g%10000
0
;
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 % 10000
0
))
Group Key: ((g % 10000))
-> Sort
Sort Key: ((g % 10000
0
))
Sort Key: ((g % 10000))
-> Function Scan on generate_series g
(5 rows)
create table agg_group_1 as
select g%10000
0
as c1, sum(g::numeric) as c2, count(*) as c3
from generate_series(0, 19999
9
) g
group by g%10000
0
;
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%10000
0
as c1, sum(g::numeric) as c2, count(*) as c3
from generate_series(0, 19999
9
) g
group by g%10000
0
;
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 % 10000
0
)
Group Key: (g % 10000)
-> Function Scan on generate_series g
(3 rows)
create table agg_hash_1 as
select g%10000
0
as c1, sum(g::numeric) as c2, count(*) as c3
from generate_series(0, 19999
9
) g
group by g%10000
0
;
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),
...
...
src/test/regress/expected/groupingsets.out
View file @
76df765e
...
...
@@ -1644,10 +1644,10 @@ SET work_mem='64kB';
set enable_hashagg = false;
set jit_above_cost = 0;
explain (costs off)
select g100
0, 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,1999
99
) 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 g100
0, 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 g100
0, 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,1999
99
) 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 g100
0, 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
src/test/regress/sql/aggregates.sql
View file @
76df765e
...
...
@@ -1066,14 +1066,14 @@ set enable_hashagg = false;
set
jit_above_cost
=
0
;
explain
(
costs
off
)
select
g
%
10000
0
as
c1
,
sum
(
g
::
numeric
)
as
c2
,
count
(
*
)
as
c3
from
generate_series
(
0
,
19999
9
)
g
group
by
g
%
10000
0
;
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
%
10000
0
as
c1
,
sum
(
g
::
numeric
)
as
c2
,
count
(
*
)
as
c3
from
generate_series
(
0
,
19999
9
)
g
group
by
g
%
10000
0
;
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
%
10000
0
as
c1
,
sum
(
g
::
numeric
)
as
c2
,
count
(
*
)
as
c3
from
generate_series
(
0
,
19999
9
)
g
group
by
g
%
10000
0
;
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
%
10000
0
as
c1
,
sum
(
g
::
numeric
)
as
c2
,
count
(
*
)
as
c3
from
generate_series
(
0
,
19999
9
)
g
group
by
g
%
10000
0
;
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
...
...
src/test/regress/sql/groupingsets.sql
View file @
76df765e
...
...
@@ -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
g100
0
,
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
,
1999
99
)
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
g100
0
,
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
g100
0
,
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
,
1999
99
)
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
g100
0
,
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
,
1999
99
)
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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment