Skip to content

Commit d2bc501

Browse files
committed
Expand coverage of parallel gather merge a bit.
Previously paths reaching heap_compare_slots weren't covered. Author: Rushabh Lathia Reviewed-By: Andres Freund Discussion: https://postgr.es/m/CAGPqQf3C+3PBujb+7m=ceWeii4-vBY=XS99LjzrpkpefvzJbFg@mail.gmail.com https://postgr.es/m/27200.1502482851@sss.pgh.pa.us Backpatch: 10, where gather merge was introduced
1 parent 9f14dc3 commit d2bc501

File tree

2 files changed

+65
-18
lines changed

2 files changed

+65
-18
lines changed

src/test/regress/expected/select_parallel.out

Lines changed: 55 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -258,32 +258,73 @@ select count(*) from tenk1, tenk2 where tenk1.unique1 = tenk2.unique1;
258258

259259
reset enable_hashjoin;
260260
reset enable_nestloop;
261-
--test gather merge
262-
set enable_hashagg to off;
261+
-- test gather merge
262+
set enable_hashagg = false;
263263
explain (costs off)
264-
select string4, count((unique2)) from tenk1 group by string4 order by string4;
264+
select count(*) from tenk1 group by twenty;
265265
QUERY PLAN
266266
----------------------------------------------------
267267
Finalize GroupAggregate
268-
Group Key: string4
268+
Group Key: twenty
269269
-> Gather Merge
270270
Workers Planned: 4
271271
-> Partial GroupAggregate
272-
Group Key: string4
272+
Group Key: twenty
273273
-> Sort
274-
Sort Key: string4
274+
Sort Key: twenty
275275
-> Parallel Seq Scan on tenk1
276276
(9 rows)
277277

278-
select string4, count((unique2)) from tenk1 group by string4 order by string4;
279-
string4 | count
280-
---------+-------
281-
AAAAxx | 2500
282-
HHHHxx | 2500
283-
OOOOxx | 2500
284-
VVVVxx | 2500
285-
(4 rows)
278+
select count(*) from tenk1 group by twenty;
279+
count
280+
-------
281+
500
282+
500
283+
500
284+
500
285+
500
286+
500
287+
500
288+
500
289+
500
290+
500
291+
500
292+
500
293+
500
294+
500
295+
500
296+
500
297+
500
298+
500
299+
500
300+
500
301+
(20 rows)
302+
303+
-- gather merge test with 0 worker
304+
set max_parallel_workers = 0;
305+
explain (costs off)
306+
select string4 from tenk1 order by string4 limit 5;
307+
QUERY PLAN
308+
----------------------------------------------
309+
Limit
310+
-> Gather Merge
311+
Workers Planned: 4
312+
-> Sort
313+
Sort Key: string4
314+
-> Parallel Seq Scan on tenk1
315+
(6 rows)
316+
317+
select string4 from tenk1 order by string4 limit 5;
318+
string4
319+
---------
320+
AAAAxx
321+
AAAAxx
322+
AAAAxx
323+
AAAAxx
324+
AAAAxx
325+
(5 rows)
286326

327+
reset max_parallel_workers;
287328
reset enable_hashagg;
288329
set force_parallel_mode=1;
289330
explain (costs off)

src/test/regress/sql/select_parallel.sql

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,14 +110,20 @@ select count(*) from tenk1, tenk2 where tenk1.unique1 = tenk2.unique1;
110110
reset enable_hashjoin;
111111
reset enable_nestloop;
112112

113-
--test gather merge
114-
set enable_hashagg to off;
113+
-- test gather merge
114+
set enable_hashagg = false;
115115

116116
explain (costs off)
117-
select string4, count((unique2)) from tenk1 group by string4 order by string4;
117+
select count(*) from tenk1 group by twenty;
118118

119-
select string4, count((unique2)) from tenk1 group by string4 order by string4;
119+
select count(*) from tenk1 group by twenty;
120120

121+
-- gather merge test with 0 worker
122+
set max_parallel_workers = 0;
123+
explain (costs off)
124+
select string4 from tenk1 order by string4 limit 5;
125+
select string4 from tenk1 order by string4 limit 5;
126+
reset max_parallel_workers;
121127
reset enable_hashagg;
122128

123129
set force_parallel_mode=1;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy