From 355d3993c53ed62c5b53d020648e4fbcfbf5f155 Mon Sep 17 00:00:00 2001 From: Robert Haas Date: Thu, 9 Mar 2017 07:40:36 -0500 Subject: Add a Gather Merge executor node. Like Gather, we spawn multiple workers and run the same plan in each one; however, Gather Merge is used when each worker produces the same output ordering and we want to preserve that output ordering while merging together the streams of tuples from various workers. (In a way, Gather Merge is like a hybrid of Gather and MergeAppend.) This works out to a win if it saves us from having to perform an expensive Sort. In cases where only a small amount of data would need to be sorted, it may actually be faster to use a regular Gather node and then sort the results afterward, because Gather Merge sometimes needs to wait synchronously for tuples whereas a pure Gather generally doesn't. But if this avoids an expensive sort then it's a win. Rushabh Lathia, reviewed and tested by Amit Kapila, Thomas Munro, and Neha Sharma, and reviewed and revised by me. Discussion: http://postgr.es/m/CAGPqQf09oPX-cQRpBKS0Gq49Z+m6KBxgxd_p9gX8CKk_d75HoQ@mail.gmail.com --- src/test/regress/sql/select_parallel.sql | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/test/regress/sql/select_parallel.sql') diff --git a/src/test/regress/sql/select_parallel.sql b/src/test/regress/sql/select_parallel.sql index 80412b990d..9311a775af 100644 --- a/src/test/regress/sql/select_parallel.sql +++ b/src/test/regress/sql/select_parallel.sql @@ -84,6 +84,17 @@ select count(*) from tenk1, tenk2 where tenk1.unique1 = tenk2.unique1; reset enable_hashjoin; reset enable_nestloop; + +--test gather merge +set enable_hashagg to off; + +explain (costs off) + select string4, count((unique2)) from tenk1 group by string4 order by string4; + +select string4, count((unique2)) from tenk1 group by string4 order by string4; + +reset enable_hashagg; + set force_parallel_mode=1; explain (costs off) -- cgit v1.2.1