pg.ddx.io pgsql-committers@postgresql.org mailing list archive
help / color / mirror / Atom feedpgsql: Add some regression tests that exercise hash join code.
13+ messages / 3 participants
[nested] [flat]
* pgsql: Add some regression tests that exercise hash join code.
@ 2017-11-30 00:16 Andres Freund <andres@anarazel.de>
2017-11-30 03:13 ` Re: pgsql: Add some regression tests that exercise hash join code. Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 13+ messages in thread
From: Andres Freund @ 2017-11-30 00:16 UTC (permalink / raw)
To: pgsql-committers
Add some regression tests that exercise hash join code.
Although hash joins are already tested by many queries, these tests
systematically cover the four different states we can reach as part of
the strategy for respecting work_mem.
Author: Thomas Munro
Reviewed-By: Andres Freund
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/fa330f9adf4e83c0707b0b1164e7bf09c9204b3d
Modified Files
--------------
src/test/regress/expected/join.out | 457 +++++++++++++++++++++++++++++++++++++
src/test/regress/sql/join.sql | 253 ++++++++++++++++++++
2 files changed, 710 insertions(+)
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: pgsql: Add some regression tests that exercise hash join code.
2017-11-30 00:16 pgsql: Add some regression tests that exercise hash join code. Andres Freund <andres@anarazel.de>
@ 2017-11-30 03:13 ` Tom Lane <tgl@sss.pgh.pa.us>
2017-11-30 03:47 ` Re: pgsql: Add some regression tests that exercise hash join code. Thomas Munro <thomas.munro@enterprisedb.com>
0 siblings, 1 reply; 13+ messages in thread
From: Tom Lane @ 2017-11-30 03:13 UTC (permalink / raw)
To: Andres Freund <andres@anarazel.de>; +Cc: pgsql-committers
Andres Freund <andres@anarazel.de> writes:
> Add some regression tests that exercise hash join code.
At least one buildfarm member doesn't like this ...
regards, tom lane
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: pgsql: Add some regression tests that exercise hash join code.
2017-11-30 00:16 pgsql: Add some regression tests that exercise hash join code. Andres Freund <andres@anarazel.de>
2017-11-30 03:13 ` Re: pgsql: Add some regression tests that exercise hash join code. Tom Lane <tgl@sss.pgh.pa.us>
@ 2017-11-30 03:47 ` Thomas Munro <thomas.munro@enterprisedb.com>
2017-11-30 10:53 ` Re: pgsql: Add some regression tests that exercise hash join code. Thomas Munro <thomas.munro@enterprisedb.com>
0 siblings, 1 reply; 13+ messages in thread
From: Thomas Munro @ 2017-11-30 03:47 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Andres Freund <andres@anarazel.de>; pgsql-committers
On Thu, Nov 30, 2017 at 4:13 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Andres Freund <andres@anarazel.de> writes:
>> Add some regression tests that exercise hash join code.
>
> At least one buildfarm member doesn't like this ...
$$);
initially_multibatch | increased_batches
----------------------+-------------------
! t | f
(1 row)
rollback to settings;
--- 6002,6008 ----
$$);
initially_multibatch | increased_batches
----------------------+-------------------
! |
(1 row)
Hmm. aholehole didn't give me the hash join EXPLAIN ANALYZE output.
All other animals are fine so far. Gah. My guess is that this is the
following unlikely sequence:
1. Worker launched.
2. Leader descheduled.
3. Worker runs whole join.
4. Leader awakes from slumber, begins running plan and tries to scan
outer relation, sees EOF, takes empty-outer optimisation and skips
building hash table.
5. Explain has no data.
It's arguably a bug that EXPLAIN ANALYZE can fail to give you what you
asked for because of details of timing and I have a patch in
development to fix that but it's not yet baked. Hmm. Wondering if
there is a quick way to avoid that case in the meantime...
--
Thomas Munro
http://www.enterprisedb.com
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: pgsql: Add some regression tests that exercise hash join code.
2017-11-30 00:16 pgsql: Add some regression tests that exercise hash join code. Andres Freund <andres@anarazel.de>
2017-11-30 03:13 ` Re: pgsql: Add some regression tests that exercise hash join code. Tom Lane <tgl@sss.pgh.pa.us>
2017-11-30 03:47 ` Re: pgsql: Add some regression tests that exercise hash join code. Thomas Munro <thomas.munro@enterprisedb.com>
@ 2017-11-30 10:53 ` Thomas Munro <thomas.munro@enterprisedb.com>
2017-11-30 16:06 ` Re: pgsql: Add some regression tests that exercise hash join code. Andres Freund <andres@anarazel.de>
0 siblings, 1 reply; 13+ messages in thread
From: Thomas Munro @ 2017-11-30 10:53 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Andres Freund <andres@anarazel.de>; pgsql-committers
On Thu, Nov 30, 2017 at 4:47 PM, Thomas Munro
<thomas.munro@enterprisedb.com> wrote:
> On Thu, Nov 30, 2017 at 4:13 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Andres Freund <andres@anarazel.de> writes:
>>> Add some regression tests that exercise hash join code.
>>
>> At least one buildfarm member doesn't like this ...
>
> $$);
> initially_multibatch | increased_batches
> ----------------------+-------------------
> ! t | f
> (1 row)
>
> rollback to settings;
> --- 6002,6008 ----
> $$);
> initially_multibatch | increased_batches
> ----------------------+-------------------
> ! |
> (1 row)
>
> Hmm. aholehole didn't give me the hash join EXPLAIN ANALYZE output.
> All other animals are fine so far. Gah. My guess is that this is the
> following unlikely sequence:
>
> 1. Worker launched.
> 2. Leader descheduled.
> 3. Worker runs whole join.
> 4. Leader awakes from slumber, begins running plan and tries to scan
> outer relation, sees EOF, takes empty-outer optimisation and skips
> building hash table.
> 5. Explain has no data.
>
> It's arguably a bug that EXPLAIN ANALYZE can fail to give you what you
> asked for because of details of timing and I have a patch in
> development to fix that but it's not yet baked. Hmm. Wondering if
> there is a quick way to avoid that case in the meantime...
A couple more have failed in the same way. If my theory above is
correct, the attached should fix the problem by skipping the affected
bits of the test for now. Once we fix EXPLAIN so that it reliably
prints hash table info no matter what (for which I should have a patch
fairly soon), we can uncomment them again. Is that an acceptable
solution for now? BTW this commit tipped nodeHash.c from yellow to
green on coverage.postgresql.org :-)
--
Thomas Munro
http://www.enterprisedb.com
Attachments:
comment-out-unstable-tests.patch (application/octet-stream, 6.6K) download
From 12c2d2d08a09026f76fa623a597d8b616d612ac1 Mon Sep 17 00:00:00 2001
From: Thomas Munro <thomas.munro@enterprisedb.com>
Date: Thu, 30 Nov 2017 23:34:09 +1300
Subject: [PATCH] Temporarily remove unstable hash join regression tests.
Commit fa330f9adf4e83c0707b0b1164e7bf09c9204b3d added a suite of regression
tests for hash joins that rely on information extracted from EXPLAIN ANALYZE
output. In some scenarios on a heavily loaded machine EXPLAIN may fail to
report hash join batching information from a parallel query. Until EXPLAIN
is fixed, comment out the problem tests.
Author: Thomas Munro
Discussion: https://www.postgresql.org/message-id/CAEepm%3D3DUQC2-z252N55eOcZBer6DPdM%3DFzrxH9dZc5vYLsjaA%40mail.gmail.com
---
src/test/regress/expected/join.out | 58 +++++++++++++-------------------------
src/test/regress/sql/join.sql | 38 ++++++++++++-------------
2 files changed, 38 insertions(+), 58 deletions(-)
diff --git a/src/test/regress/expected/join.out b/src/test/regress/expected/join.out
index b7d17900978..df2c033531f 100644
--- a/src/test/regress/expected/join.out
+++ b/src/test/regress/expected/join.out
@@ -5945,16 +5945,11 @@ select count(*) from simple r join simple s using (id);
20000
(1 row)
-select original > 1 as initially_multibatch, final > original as increased_batches
- from hash_join_batches(
-$$
- select count(*) from simple r join simple s using (id);
-$$);
- initially_multibatch | increased_batches
-----------------------+-------------------
- f | f
-(1 row)
-
+--select original > 1 as initially_multibatch, final > original as increased_batches
+-- from hash_join_batches(
+--$$
+-- select count(*) from simple r join simple s using (id);
+--$$);
rollback to settings;
-- The "good" case: batches required, but we plan the right number; we
-- plan for some number of batches, and we stick to that number, and
@@ -6017,16 +6012,11 @@ select count(*) from simple r join simple s using (id);
20000
(1 row)
-select original > 1 as initially_multibatch, final > original as increased_batches
- from hash_join_batches(
-$$
- select count(*) from simple r join simple s using (id);
-$$);
- initially_multibatch | increased_batches
-----------------------+-------------------
- t | f
-(1 row)
-
+--select original > 1 as initially_multibatch, final > original as increased_batches
+-- from hash_join_batches(
+--$$
+-- select count(*) from simple r join simple s using (id);
+--$$);
rollback to settings;
-- The "bad" case: during execution we need to increase number of
-- batches; in this case we plan for 1 batch, and increase at least a
@@ -6090,16 +6080,11 @@ select count(*) from simple r join bigger_than_it_looks s using (id);
20000
(1 row)
-select original > 1 as initially_multibatch, final > original as increased_batches
- from hash_join_batches(
-$$
- select count(*) from simple r join bigger_than_it_looks s using (id);
-$$);
- initially_multibatch | increased_batches
-----------------------+-------------------
- f | t
-(1 row)
-
+--select original > 1 as initially_multibatch, final > original as increased_batches
+-- from hash_join_batches(
+--$$
+-- select count(*) from simple r join bigger_than_it_looks s using (id);
+--$$);
rollback to settings;
-- The "ugly" case: increasing the number of batches during execution
-- doesn't help, so stop trying to fit in work_mem and hope for the
@@ -6162,15 +6147,10 @@ select count(*) from simple r join extremely_skewed s using (id);
20000
(1 row)
-select * from hash_join_batches(
-$$
- select count(*) from simple r join extremely_skewed s using (id);
-$$);
- original | final
-----------+-------
- 1 | 2
-(1 row)
-
+--select * from hash_join_batches(
+--$$
+-- select count(*) from simple r join extremely_skewed s using (id);
+--$$);
rollback to settings;
-- A couple of other hash join tests unrelated to work_mem management.
-- A full outer join where every record is matched.
diff --git a/src/test/regress/sql/join.sql b/src/test/regress/sql/join.sql
index c6d4a513e86..ae091030c86 100644
--- a/src/test/regress/sql/join.sql
+++ b/src/test/regress/sql/join.sql
@@ -2053,11 +2053,11 @@ set local work_mem = '4MB';
explain (costs off)
select count(*) from simple r join simple s using (id);
select count(*) from simple r join simple s using (id);
-select original > 1 as initially_multibatch, final > original as increased_batches
- from hash_join_batches(
-$$
- select count(*) from simple r join simple s using (id);
-$$);
+--select original > 1 as initially_multibatch, final > original as increased_batches
+-- from hash_join_batches(
+--$$
+-- select count(*) from simple r join simple s using (id);
+--$$);
rollback to settings;
-- The "good" case: batches required, but we plan the right number; we
@@ -2085,11 +2085,11 @@ set local work_mem = '128kB';
explain (costs off)
select count(*) from simple r join simple s using (id);
select count(*) from simple r join simple s using (id);
-select original > 1 as initially_multibatch, final > original as increased_batches
- from hash_join_batches(
-$$
- select count(*) from simple r join simple s using (id);
-$$);
+--select original > 1 as initially_multibatch, final > original as increased_batches
+-- from hash_join_batches(
+--$$
+-- select count(*) from simple r join simple s using (id);
+--$$);
rollback to settings;
-- The "bad" case: during execution we need to increase number of
@@ -2118,11 +2118,11 @@ set local work_mem = '128kB';
explain (costs off)
select count(*) from simple r join bigger_than_it_looks s using (id);
select count(*) from simple r join bigger_than_it_looks s using (id);
-select original > 1 as initially_multibatch, final > original as increased_batches
- from hash_join_batches(
-$$
- select count(*) from simple r join bigger_than_it_looks s using (id);
-$$);
+--select original > 1 as initially_multibatch, final > original as increased_batches
+-- from hash_join_batches(
+--$$
+-- select count(*) from simple r join bigger_than_it_looks s using (id);
+--$$);
rollback to settings;
-- The "ugly" case: increasing the number of batches during execution
@@ -2151,10 +2151,10 @@ set local work_mem = '128kB';
explain (costs off)
select count(*) from simple r join extremely_skewed s using (id);
select count(*) from simple r join extremely_skewed s using (id);
-select * from hash_join_batches(
-$$
- select count(*) from simple r join extremely_skewed s using (id);
-$$);
+--select * from hash_join_batches(
+--$$
+-- select count(*) from simple r join extremely_skewed s using (id);
+--$$);
rollback to settings;
-- A couple of other hash join tests unrelated to work_mem management.
--
2.15.0
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: pgsql: Add some regression tests that exercise hash join code.
2017-11-30 00:16 pgsql: Add some regression tests that exercise hash join code. Andres Freund <andres@anarazel.de>
2017-11-30 03:13 ` Re: pgsql: Add some regression tests that exercise hash join code. Tom Lane <tgl@sss.pgh.pa.us>
2017-11-30 03:47 ` Re: pgsql: Add some regression tests that exercise hash join code. Thomas Munro <thomas.munro@enterprisedb.com>
2017-11-30 10:53 ` Re: pgsql: Add some regression tests that exercise hash join code. Thomas Munro <thomas.munro@enterprisedb.com>
@ 2017-11-30 16:06 ` Andres Freund <andres@anarazel.de>
2017-12-03 18:39 ` Re: pgsql: Add some regression tests that exercise hash join code. Andres Freund <andres@anarazel.de>
0 siblings, 1 reply; 13+ messages in thread
From: Andres Freund @ 2017-11-30 16:06 UTC (permalink / raw)
To: Thomas Munro <thomas.munro@enterprisedb.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; pgsql-committers
Hi,
On 2017-11-30 23:53:55 +1300, Thomas Munro wrote:
> On Thu, Nov 30, 2017 at 4:47 PM, Thomas Munro
> <thomas.munro@enterprisedb.com> wrote:
> > On Thu, Nov 30, 2017 at 4:13 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> >> Andres Freund <andres@anarazel.de> writes:
> >>> Add some regression tests that exercise hash join code.
> >>
> >> At least one buildfarm member doesn't like this ...
> >
> > $$);
> > initially_multibatch | increased_batches
> > ----------------------+-------------------
> > ! t | f
> > (1 row)
> >
> > rollback to settings;
> > --- 6002,6008 ----
> > $$);
> > initially_multibatch | increased_batches
> > ----------------------+-------------------
> > ! |
> > (1 row)
> >
> > Hmm. aholehole didn't give me the hash join EXPLAIN ANALYZE output.
> > All other animals are fine so far. Gah. My guess is that this is the
> > following unlikely sequence:
> >
> > 1. Worker launched.
> > 2. Leader descheduled.
> > 3. Worker runs whole join.
> > 4. Leader awakes from slumber, begins running plan and tries to scan
> > outer relation, sees EOF, takes empty-outer optimisation and skips
> > building hash table.
> > 5. Explain has no data.
> >
> > It's arguably a bug that EXPLAIN ANALYZE can fail to give you what you
> > asked for because of details of timing and I have a patch in
> > development to fix that but it's not yet baked. Hmm. Wondering if
> > there is a quick way to avoid that case in the meantime...
>
> A couple more have failed in the same way. If my theory above is
> correct, the attached should fix the problem by skipping the affected
> bits of the test for now. Once we fix EXPLAIN so that it reliably
> prints hash table info no matter what (for which I should have a patch
> fairly soon), we can uncomment them again. Is that an acceptable
> solution for now? BTW this commit tipped nodeHash.c from yellow to
> green on coverage.postgresql.org :-)
At the current rate of failure I'm slightly inclined to just leave the
occasionally failing test, which sounds like an actual bug imo, in place
till we have the fix. But if there's any pushback I'll go with your
disablign patch till then.
- Andres
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: pgsql: Add some regression tests that exercise hash join code.
2017-11-30 00:16 pgsql: Add some regression tests that exercise hash join code. Andres Freund <andres@anarazel.de>
2017-11-30 03:13 ` Re: pgsql: Add some regression tests that exercise hash join code. Tom Lane <tgl@sss.pgh.pa.us>
2017-11-30 03:47 ` Re: pgsql: Add some regression tests that exercise hash join code. Thomas Munro <thomas.munro@enterprisedb.com>
2017-11-30 10:53 ` Re: pgsql: Add some regression tests that exercise hash join code. Thomas Munro <thomas.munro@enterprisedb.com>
2017-11-30 16:06 ` Re: pgsql: Add some regression tests that exercise hash join code. Andres Freund <andres@anarazel.de>
@ 2017-12-03 18:39 ` Andres Freund <andres@anarazel.de>
2017-12-03 20:12 ` Re: pgsql: Add some regression tests that exercise hash join code. Thomas Munro <thomas.munro@enterprisedb.com>
0 siblings, 1 reply; 13+ messages in thread
From: Andres Freund @ 2017-12-03 18:39 UTC (permalink / raw)
To: Thomas Munro <thomas.munro@enterprisedb.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; pgsql-committers
On 2017-11-30 08:06:44 -0800, Andres Freund wrote:
> Hi,
>
> On 2017-11-30 23:53:55 +1300, Thomas Munro wrote:
> > On Thu, Nov 30, 2017 at 4:47 PM, Thomas Munro
> > <thomas.munro@enterprisedb.com> wrote:
> > > On Thu, Nov 30, 2017 at 4:13 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> > >> Andres Freund <andres@anarazel.de> writes:
> > >>> Add some regression tests that exercise hash join code.
> > >>
> > >> At least one buildfarm member doesn't like this ...
> > >
> > > $$);
> > > initially_multibatch | increased_batches
> > > ----------------------+-------------------
> > > ! t | f
> > > (1 row)
> > >
> > > rollback to settings;
> > > --- 6002,6008 ----
> > > $$);
> > > initially_multibatch | increased_batches
> > > ----------------------+-------------------
> > > ! |
> > > (1 row)
> > >
> > > Hmm. aholehole didn't give me the hash join EXPLAIN ANALYZE output.
> > > All other animals are fine so far. Gah. My guess is that this is the
> > > following unlikely sequence:
> > >
> > > 1. Worker launched.
> > > 2. Leader descheduled.
> > > 3. Worker runs whole join.
> > > 4. Leader awakes from slumber, begins running plan and tries to scan
> > > outer relation, sees EOF, takes empty-outer optimisation and skips
> > > building hash table.
> > > 5. Explain has no data.
> > >
> > > It's arguably a bug that EXPLAIN ANALYZE can fail to give you what you
> > > asked for because of details of timing and I have a patch in
> > > development to fix that but it's not yet baked. Hmm. Wondering if
> > > there is a quick way to avoid that case in the meantime...
> >
> > A couple more have failed in the same way. If my theory above is
> > correct, the attached should fix the problem by skipping the affected
> > bits of the test for now. Once we fix EXPLAIN so that it reliably
> > prints hash table info no matter what (for which I should have a patch
> > fairly soon), we can uncomment them again. Is that an acceptable
> > solution for now? BTW this commit tipped nodeHash.c from yellow to
> > green on coverage.postgresql.org :-)
>
> At the current rate of failure I'm slightly inclined to just leave the
> occasionally failing test, which sounds like an actual bug imo, in place
> till we have the fix. But if there's any pushback I'll go with your
> disablign patch till then.
Thomas, any updates on the status of that explain fix?
Greetings,
Andres Freund
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: pgsql: Add some regression tests that exercise hash join code.
2017-11-30 00:16 pgsql: Add some regression tests that exercise hash join code. Andres Freund <andres@anarazel.de>
2017-11-30 03:13 ` Re: pgsql: Add some regression tests that exercise hash join code. Tom Lane <tgl@sss.pgh.pa.us>
2017-11-30 03:47 ` Re: pgsql: Add some regression tests that exercise hash join code. Thomas Munro <thomas.munro@enterprisedb.com>
2017-11-30 10:53 ` Re: pgsql: Add some regression tests that exercise hash join code. Thomas Munro <thomas.munro@enterprisedb.com>
2017-11-30 16:06 ` Re: pgsql: Add some regression tests that exercise hash join code. Andres Freund <andres@anarazel.de>
2017-12-03 18:39 ` Re: pgsql: Add some regression tests that exercise hash join code. Andres Freund <andres@anarazel.de>
@ 2017-12-03 20:12 ` Thomas Munro <thomas.munro@enterprisedb.com>
2017-12-03 23:18 ` Re: pgsql: Add some regression tests that exercise hash join code. Thomas Munro <thomas.munro@enterprisedb.com>
0 siblings, 1 reply; 13+ messages in thread
From: Thomas Munro @ 2017-12-03 20:12 UTC (permalink / raw)
To: Andres Freund <andres@anarazel.de>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; pgsql-committers
On Mon, Dec 4, 2017 at 7:39 AM, Andres Freund <andres@anarazel.de> wrote:
> On 2017-11-30 08:06:44 -0800, Andres Freund wrote:
>> At the current rate of failure I'm slightly inclined to just leave the
>> occasionally failing test, which sounds like an actual bug imo, in place
>> till we have the fix. But if there's any pushback I'll go with your
>> disablign patch till then.
>
> Thomas, any updates on the status of that explain fix?
Will post today.
--
Thomas Munro
http://www.enterprisedb.com
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: pgsql: Add some regression tests that exercise hash join code.
2017-11-30 00:16 pgsql: Add some regression tests that exercise hash join code. Andres Freund <andres@anarazel.de>
2017-11-30 03:13 ` Re: pgsql: Add some regression tests that exercise hash join code. Tom Lane <tgl@sss.pgh.pa.us>
2017-11-30 03:47 ` Re: pgsql: Add some regression tests that exercise hash join code. Thomas Munro <thomas.munro@enterprisedb.com>
2017-11-30 10:53 ` Re: pgsql: Add some regression tests that exercise hash join code. Thomas Munro <thomas.munro@enterprisedb.com>
2017-11-30 16:06 ` Re: pgsql: Add some regression tests that exercise hash join code. Andres Freund <andres@anarazel.de>
2017-12-03 18:39 ` Re: pgsql: Add some regression tests that exercise hash join code. Andres Freund <andres@anarazel.de>
2017-12-03 20:12 ` Re: pgsql: Add some regression tests that exercise hash join code. Thomas Munro <thomas.munro@enterprisedb.com>
@ 2017-12-03 23:18 ` Thomas Munro <thomas.munro@enterprisedb.com>
2017-12-03 23:28 ` Re: pgsql: Add some regression tests that exercise hash join code. Thomas Munro <thomas.munro@enterprisedb.com>
0 siblings, 1 reply; 13+ messages in thread
From: Thomas Munro @ 2017-12-03 23:18 UTC (permalink / raw)
To: Andres Freund <andres@anarazel.de>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; pgsql-committers
On Mon, Dec 4, 2017 at 9:12 AM, Thomas Munro
<thomas.munro@enterprisedb.com> wrote:
> On Mon, Dec 4, 2017 at 7:39 AM, Andres Freund <andres@anarazel.de> wrote:
>> On 2017-11-30 08:06:44 -0800, Andres Freund wrote:
>>> At the current rate of failure I'm slightly inclined to just leave the
>>> occasionally failing test, which sounds like an actual bug imo, in place
>>> till we have the fix. But if there's any pushback I'll go with your
>>> disablign patch till then.
>>
>> Thomas, any updates on the status of that explain fix?
>
> Will post today.
Here it is. Thoughts?
--
Thomas Munro
http://www.enterprisedb.com
Attachments:
fix-explain-analyze-hash-join-v1.patch (application/octet-stream, 14.8K) download
From e4ee81280893d5bf55ac3289b34c7b91bded6011 Mon Sep 17 00:00:00 2001
From: Thomas Munro <thomas.munro@enterprisedb.com>
Date: Mon, 4 Dec 2017 11:52:11 +1300
Subject: [PATCH] Fix EXPLAIN ANALYZE of hash join when the leader doesn't
execute.
If a hash join appears in a parallel query, there may be no hash table
available for explain.c to inspect, though a hash table may have been built
in other processes. This could happen either because
parallel_leader_participation was set of off or because the leader happened to
hit the end of the outer relation immediately (even though the complete
relation is not empty) and decided not to build the hash table.
Commit bf11e7ee introduced a way for workers to exchange instrumentation via
the DSM segment for Sort nodes even though they are not parallel-aware. This
commit does the same for Hash nodes, so that explain.c has a way to find
intrumentation data from an arbitrary participant that actually built the hash
table.
Author: Thomas Munro
Reviewed-By:
Discussion: https://postgr.es/m/CAEepm%3D3DUQC2-z252N55eOcZBer6DPdM%3DFzrxH9dZc5vYLsjaA%40mail.gmail.com
---
src/backend/commands/explain.c | 58 +++++++++++++++++------
src/backend/executor/execParallel.c | 31 ++++++++++---
src/backend/executor/execProcnode.c | 3 ++
src/backend/executor/nodeHash.c | 91 +++++++++++++++++++++++++++++++++++++
src/include/executor/nodeHash.h | 8 ++++
src/include/nodes/execnodes.h | 26 +++++++++++
src/test/regress/expected/join.out | 15 ++++++
src/test/regress/sql/join.sql | 11 +++++
8 files changed, 222 insertions(+), 21 deletions(-)
diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c
index 447f69d044e..1ffe635d66c 100644
--- a/src/backend/commands/explain.c
+++ b/src/backend/commands/explain.c
@@ -2379,34 +2379,62 @@ show_sort_info(SortState *sortstate, ExplainState *es)
static void
show_hash_info(HashState *hashstate, ExplainState *es)
{
- HashJoinTable hashtable;
+ HashInstrumentation *hinstrument = NULL;
- hashtable = hashstate->hashtable;
+ /*
+ * In a parallel query, the leader process may or may not have run the
+ * hash join, and even if it did it may not have built a hash table due to
+ * timing (if it started late it might have seen no tuples in the outer
+ * relation and skipped building the hash table). Therefore we have to be
+ * prepared to get instrumentation data from a worker if there is no hash
+ * table.
+ */
+ if (hashstate->hashtable)
+ {
+ hinstrument = (HashInstrumentation *)
+ palloc(sizeof(HashInstrumentation));
+ ExecHashGetInstrumentation(hinstrument, hashstate->hashtable);
+ }
+ else if (hashstate->shared_info)
+ {
+ SharedHashInfo *shared_info = hashstate->shared_info;
+ int i;
+
+ /* Find the first worker that built a hash table. */
+ for (i = 0; i < shared_info->num_workers; ++i)
+ {
+ if (shared_info->hinstrument[i].nbatch > 0)
+ {
+ hinstrument = &shared_info->hinstrument[i];
+ break;
+ }
+ }
+ }
- if (hashtable)
+ if (hinstrument)
{
- long spacePeakKb = (hashtable->spacePeak + 1023) / 1024;
+ long spacePeakKb = (hinstrument->space_peak + 1023) / 1024;
if (es->format != EXPLAIN_FORMAT_TEXT)
{
- ExplainPropertyLong("Hash Buckets", hashtable->nbuckets, es);
+ ExplainPropertyLong("Hash Buckets", hinstrument->nbuckets, es);
ExplainPropertyLong("Original Hash Buckets",
- hashtable->nbuckets_original, es);
- ExplainPropertyLong("Hash Batches", hashtable->nbatch, es);
+ hinstrument->nbuckets_original, es);
+ ExplainPropertyLong("Hash Batches", hinstrument->nbatch, es);
ExplainPropertyLong("Original Hash Batches",
- hashtable->nbatch_original, es);
+ hinstrument->nbatch_original, es);
ExplainPropertyLong("Peak Memory Usage", spacePeakKb, es);
}
- else if (hashtable->nbatch_original != hashtable->nbatch ||
- hashtable->nbuckets_original != hashtable->nbuckets)
+ else if (hinstrument->nbatch_original != hinstrument->nbatch ||
+ hinstrument->nbuckets_original != hinstrument->nbuckets)
{
appendStringInfoSpaces(es->str, es->indent * 2);
appendStringInfo(es->str,
"Buckets: %d (originally %d) Batches: %d (originally %d) Memory Usage: %ldkB\n",
- hashtable->nbuckets,
- hashtable->nbuckets_original,
- hashtable->nbatch,
- hashtable->nbatch_original,
+ hinstrument->nbuckets,
+ hinstrument->nbuckets_original,
+ hinstrument->nbatch,
+ hinstrument->nbatch_original,
spacePeakKb);
}
else
@@ -2414,7 +2442,7 @@ show_hash_info(HashState *hashstate, ExplainState *es)
appendStringInfoSpaces(es->str, es->indent * 2);
appendStringInfo(es->str,
"Buckets: %d Batches: %d Memory Usage: %ldkB\n",
- hashtable->nbuckets, hashtable->nbatch,
+ hinstrument->nbuckets, hinstrument->nbatch,
spacePeakKb);
}
}
diff --git a/src/backend/executor/execParallel.c b/src/backend/executor/execParallel.c
index 53c5254be13..f2adfb15ef5 100644
--- a/src/backend/executor/execParallel.c
+++ b/src/backend/executor/execParallel.c
@@ -29,6 +29,7 @@
#include "executor/nodeBitmapHeapscan.h"
#include "executor/nodeCustom.h"
#include "executor/nodeForeignscan.h"
+#include "executor/nodeHash.h"
#include "executor/nodeIndexscan.h"
#include "executor/nodeIndexonlyscan.h"
#include "executor/nodeSeqscan.h"
@@ -259,6 +260,10 @@ ExecParallelEstimate(PlanState *planstate, ExecParallelEstimateContext *e)
ExecBitmapHeapEstimate((BitmapHeapScanState *) planstate,
e->pcxt);
break;
+ case T_HashState:
+ /* even when not parallel-aware */
+ ExecHashEstimate((HashState *) planstate, e->pcxt);
+ break;
case T_SortState:
/* even when not parallel-aware */
ExecSortEstimate((SortState *) planstate, e->pcxt);
@@ -458,6 +463,10 @@ ExecParallelInitializeDSM(PlanState *planstate,
ExecBitmapHeapInitializeDSM((BitmapHeapScanState *) planstate,
d->pcxt);
break;
+ case T_HashState:
+ /* even when not parallel-aware */
+ ExecHashInitializeDSM((HashState *) planstate, d->pcxt);
+ break;
case T_SortState:
/* even when not parallel-aware */
ExecSortInitializeDSM((SortState *) planstate, d->pcxt);
@@ -928,12 +937,18 @@ ExecParallelRetrieveInstrumentation(PlanState *planstate,
planstate->worker_instrument->num_workers = instrumentation->num_workers;
memcpy(&planstate->worker_instrument->instrument, instrument, ibytes);
- /*
- * Perform any node-type-specific work that needs to be done. Currently,
- * only Sort nodes need to do anything here.
- */
- if (IsA(planstate, SortState))
- ExecSortRetrieveInstrumentation((SortState *) planstate);
+ /* Perform any node-type-specific work that needs to be done. */
+ switch (nodeTag(planstate))
+ {
+ case T_SortState:
+ ExecSortRetrieveInstrumentation((SortState *) planstate);
+ break;
+ case T_HashState:
+ ExecHashRetrieveInstrumentation((HashState *) planstate);
+ break;
+ default:
+ break;
+ }
return planstate_tree_walker(planstate, ExecParallelRetrieveInstrumentation,
instrumentation);
@@ -1160,6 +1175,10 @@ ExecParallelInitializeWorker(PlanState *planstate, ParallelWorkerContext *pwcxt)
ExecBitmapHeapInitializeWorker((BitmapHeapScanState *) planstate,
pwcxt);
break;
+ case T_HashState:
+ /* even when not parallel-aware */
+ ExecHashInitializeWorker((HashState *) planstate, pwcxt);
+ break;
case T_SortState:
/* even when not parallel-aware */
ExecSortInitializeWorker((SortState *) planstate, pwcxt);
diff --git a/src/backend/executor/execProcnode.c b/src/backend/executor/execProcnode.c
index c1aa5064c90..9befca90161 100644
--- a/src/backend/executor/execProcnode.c
+++ b/src/backend/executor/execProcnode.c
@@ -751,6 +751,9 @@ ExecShutdownNode(PlanState *node)
case T_GatherMergeState:
ExecShutdownGatherMerge((GatherMergeState *) node);
break;
+ case T_HashState:
+ ExecShutdownHash((HashState *) node);
+ break;
default:
break;
}
diff --git a/src/backend/executor/nodeHash.c b/src/backend/executor/nodeHash.c
index f7cd8fb3472..afd7384e945 100644
--- a/src/backend/executor/nodeHash.c
+++ b/src/backend/executor/nodeHash.c
@@ -1637,6 +1637,97 @@ ExecHashRemoveNextSkewBucket(HashJoinTable hashtable)
}
}
+/*
+ * Reserve space in the DSM segment for instrumentation data.
+ */
+void
+ExecHashEstimate(HashState *node, ParallelContext *pcxt)
+{
+ size_t size;
+
+ size = mul_size(pcxt->nworkers, sizeof(HashInstrumentation));
+ size = add_size(size, offsetof(SharedHashInfo, hinstrument));
+ shm_toc_estimate_chunk(&pcxt->estimator, size);
+ shm_toc_estimate_keys(&pcxt->estimator, 1);
+}
+
+/*
+ * Set up a space in the DSM for all workers to record instrumentation data
+ * about their hash table.
+ */
+void
+ExecHashInitializeDSM(HashState *node, ParallelContext *pcxt)
+{
+ size_t size;
+
+ size = offsetof(SharedHashInfo, hinstrument) +
+ pcxt->nworkers * sizeof(HashInstrumentation);
+ node->shared_info = (SharedHashInfo *) shm_toc_allocate(pcxt->toc, size);
+ memset(node->shared_info, 0, size);
+ node->shared_info->num_workers = pcxt->nworkers;
+ shm_toc_insert(pcxt->toc, node->ps.plan->plan_node_id,
+ node->shared_info);
+}
+
+/*
+ * Locate the DSM space for hash table instrumentation data that we'll write
+ * to at shutdown time.
+ */
+void
+ExecHashInitializeWorker(HashState *node, ParallelWorkerContext *pwcxt)
+{
+ SharedHashInfo *shared_info;
+
+ shared_info = (SharedHashInfo *)
+ shm_toc_lookup(pwcxt->toc, node->ps.plan->plan_node_id, true);
+ node->hinstrument = &shared_info->hinstrument[ParallelWorkerNumber];
+}
+
+/*
+ * Copy instrumentation data from this worker's hash table (if it built one)
+ * to DSM memory so the leader can retrieve it. This must be done in an
+ * ExecShutdownHash() rather than ExecEndHash() because the latter runs after
+ * we've detached from the DSM segment.
+ */
+void
+ExecShutdownHash(HashState *node)
+{
+ if (node->hinstrument && node->hashtable)
+ ExecHashGetInstrumentation(node->hinstrument, node->hashtable);
+}
+
+/*
+ * Retrieve instrumentation data from workers before the DSM segment is
+ * detached, so that EXPLAIN can access it.
+ */
+void
+ExecHashRetrieveInstrumentation(HashState *node)
+{
+ SharedHashInfo *shared_info = node->shared_info;
+ size_t size;
+
+ /* Replace node->shared_info with a copy in backend-local memory. */
+ size = offsetof(SharedHashInfo, hinstrument) +
+ shared_info->num_workers * sizeof(HashInstrumentation);
+ node->shared_info = palloc(size);
+ memcpy(node->shared_info, shared_info, size);
+}
+
+/*
+ * Copy the instrumentation data from 'hashtable' into a HashInstrumentation
+ * struct.
+ */
+void
+ExecHashGetInstrumentation(HashInstrumentation *instrument,
+ HashJoinTable hashtable)
+{
+ instrument->nbuckets = hashtable->nbuckets;
+ instrument->nbuckets_original = hashtable->nbuckets_original;
+ instrument->nbatch = hashtable->nbatch;
+ instrument->nbatch_original = hashtable->nbatch_original;
+ instrument->space_peak = hashtable->spacePeak;
+}
+
/*
* Allocate 'size' bytes from the currently active HashMemoryChunk
*/
diff --git a/src/include/executor/nodeHash.h b/src/include/executor/nodeHash.h
index 3ae556fb6c5..0974f1edc21 100644
--- a/src/include/executor/nodeHash.h
+++ b/src/include/executor/nodeHash.h
@@ -14,6 +14,7 @@
#ifndef NODEHASH_H
#define NODEHASH_H
+#include "access/parallel.h"
#include "nodes/execnodes.h"
extern HashState *ExecInitHash(Hash *node, EState *estate, int eflags);
@@ -48,5 +49,12 @@ extern void ExecChooseHashTableSize(double ntuples, int tupwidth, bool useskew,
int *numbatches,
int *num_skew_mcvs);
extern int ExecHashGetSkewBucket(HashJoinTable hashtable, uint32 hashvalue);
+extern void ExecHashEstimate(HashState *node, ParallelContext *pcxt);
+extern void ExecHashInitializeDSM(HashState *node, ParallelContext *pcxt);
+extern void ExecHashInitializeWorker(HashState *node, ParallelWorkerContext *pwcxt);
+extern void ExecHashRetrieveInstrumentation(HashState *node);
+extern void ExecShutdownHash(HashState *node);
+extern void ExecHashGetInstrumentation(HashInstrumentation *instrument,
+ HashJoinTable hashtable);
#endif /* NODEHASH_H */
diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h
index e05bc04f525..6c322e57c00 100644
--- a/src/include/nodes/execnodes.h
+++ b/src/include/nodes/execnodes.h
@@ -1980,6 +1980,29 @@ typedef struct GatherMergeState
struct binaryheap *gm_heap; /* binary heap of slot indices */
} GatherMergeState;
+/* ----------------
+ * Values displayed by EXPLAIN ANALYZE
+ * ----------------
+ */
+typedef struct HashInstrumentation
+{
+ int nbuckets;
+ int nbuckets_original;
+ int nbatch;
+ int nbatch_original;
+ size_t space_peak;
+} HashInstrumentation;
+
+/* ----------------
+ * Shared memory container for per-worker hash information
+ * ----------------
+ */
+typedef struct SharedHashInfo
+{
+ int num_workers;
+ HashInstrumentation hinstrument[FLEXIBLE_ARRAY_MEMBER];
+} SharedHashInfo;
+
/* ----------------
* HashState information
* ----------------
@@ -1990,6 +2013,9 @@ typedef struct HashState
HashJoinTable hashtable; /* hash table for the hashjoin */
List *hashkeys; /* list of ExprState nodes */
/* hashkeys is same as parent's hj_InnerHashKeys */
+
+ SharedHashInfo *shared_info; /* one entry per worker */
+ HashInstrumentation *hinstrument; /* this worker's entry */
} HashState;
/* ----------------
diff --git a/src/test/regress/expected/join.out b/src/test/regress/expected/join.out
index b7d17900978..001d96dc2d8 100644
--- a/src/test/regress/expected/join.out
+++ b/src/test/regress/expected/join.out
@@ -6173,6 +6173,21 @@ $$);
rollback to settings;
-- A couple of other hash join tests unrelated to work_mem management.
+-- Check that EXPLAIN ANALYZE has data even if the leader doesn't participate
+savepoint settings;
+set local max_parallel_workers_per_gather = 2;
+set local work_mem = '4MB';
+set local parallel_leader_participation = off;
+select * from hash_join_batches(
+$$
+ select count(*) from simple r join simple s using (id);
+$$);
+ original | final
+----------+-------
+ 1 | 1
+(1 row)
+
+rollback to settings;
-- A full outer join where every record is matched.
-- non-parallel
savepoint settings;
diff --git a/src/test/regress/sql/join.sql b/src/test/regress/sql/join.sql
index c6d4a513e86..882601b3388 100644
--- a/src/test/regress/sql/join.sql
+++ b/src/test/regress/sql/join.sql
@@ -2159,6 +2159,17 @@ rollback to settings;
-- A couple of other hash join tests unrelated to work_mem management.
+-- Check that EXPLAIN ANALYZE has data even if the leader doesn't participate
+savepoint settings;
+set local max_parallel_workers_per_gather = 2;
+set local work_mem = '4MB';
+set local parallel_leader_participation = off;
+select * from hash_join_batches(
+$$
+ select count(*) from simple r join simple s using (id);
+$$);
+rollback to settings;
+
-- A full outer join where every record is matched.
-- non-parallel
--
2.15.0
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: pgsql: Add some regression tests that exercise hash join code.
2017-11-30 00:16 pgsql: Add some regression tests that exercise hash join code. Andres Freund <andres@anarazel.de>
2017-11-30 03:13 ` Re: pgsql: Add some regression tests that exercise hash join code. Tom Lane <tgl@sss.pgh.pa.us>
2017-11-30 03:47 ` Re: pgsql: Add some regression tests that exercise hash join code. Thomas Munro <thomas.munro@enterprisedb.com>
2017-11-30 10:53 ` Re: pgsql: Add some regression tests that exercise hash join code. Thomas Munro <thomas.munro@enterprisedb.com>
2017-11-30 16:06 ` Re: pgsql: Add some regression tests that exercise hash join code. Andres Freund <andres@anarazel.de>
2017-12-03 18:39 ` Re: pgsql: Add some regression tests that exercise hash join code. Andres Freund <andres@anarazel.de>
2017-12-03 20:12 ` Re: pgsql: Add some regression tests that exercise hash join code. Thomas Munro <thomas.munro@enterprisedb.com>
2017-12-03 23:18 ` Re: pgsql: Add some regression tests that exercise hash join code. Thomas Munro <thomas.munro@enterprisedb.com>
@ 2017-12-03 23:28 ` Thomas Munro <thomas.munro@enterprisedb.com>
2017-12-04 20:21 ` Re: pgsql: Add some regression tests that exercise hash join code. Andres Freund <andres@anarazel.de>
0 siblings, 1 reply; 13+ messages in thread
From: Thomas Munro @ 2017-12-03 23:28 UTC (permalink / raw)
To: Andres Freund <andres@anarazel.de>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; pgsql-committers
On Mon, Dec 4, 2017 at 12:18 PM, Thomas Munro
<thomas.munro@enterprisedb.com> wrote:
> On Mon, Dec 4, 2017 at 9:12 AM, Thomas Munro
> <thomas.munro@enterprisedb.com> wrote:
>> On Mon, Dec 4, 2017 at 7:39 AM, Andres Freund <andres@anarazel.de> wrote:
>>> On 2017-11-30 08:06:44 -0800, Andres Freund wrote:
>>>> At the current rate of failure I'm slightly inclined to just leave the
>>>> occasionally failing test, which sounds like an actual bug imo, in place
>>>> till we have the fix. But if there's any pushback I'll go with your
>>>> disablign patch till then.
>>>
>>> Thomas, any updates on the status of that explain fix?
>>
>> Will post today.
>
> Here it is. Thoughts?
Here's a version with a better commit message.
--
Thomas Munro
http://www.enterprisedb.com
Attachments:
fix-explain-analyze-hash-join-v2.patch (application/octet-stream, 14.8K) download
From 43eeea0bc35204440d262224b56efca958b33428 Mon Sep 17 00:00:00 2001
From: Thomas Munro <thomas.munro@enterprisedb.com>
Date: Mon, 4 Dec 2017 11:52:11 +1300
Subject: [PATCH] Fix EXPLAIN ANALYZE of hash join when the leader doesn't
execute.
If a hash join appears in a parallel query, there may be no hash table
available for explain.c to inspect even though a hash table may have been
built in other processes. This could happen either because
parallel_leader_participation was set to off or because the leader happened to
hit the end of the outer relation immediately (even though the complete
relation is not empty) and decided not to build the hash table.
Commit bf11e7ee introduced a way for workers to exchange instrumentation via
the DSM segment for Sort nodes even though they are not parallel-aware. This
commit does the same for Hash nodes, so that explain.c has a way to find
instrumentation data from an arbitrary participant that actually built the
hash table.
Author: Thomas Munro
Reviewed-By:
Discussion: https://postgr.es/m/CAEepm%3D3DUQC2-z252N55eOcZBer6DPdM%3DFzrxH9dZc5vYLsjaA%40mail.gmail.com
---
src/backend/commands/explain.c | 58 +++++++++++++++++------
src/backend/executor/execParallel.c | 31 ++++++++++---
src/backend/executor/execProcnode.c | 3 ++
src/backend/executor/nodeHash.c | 91 +++++++++++++++++++++++++++++++++++++
src/include/executor/nodeHash.h | 8 ++++
src/include/nodes/execnodes.h | 26 +++++++++++
src/test/regress/expected/join.out | 15 ++++++
src/test/regress/sql/join.sql | 11 +++++
8 files changed, 222 insertions(+), 21 deletions(-)
diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c
index 447f69d044e..1ffe635d66c 100644
--- a/src/backend/commands/explain.c
+++ b/src/backend/commands/explain.c
@@ -2379,34 +2379,62 @@ show_sort_info(SortState *sortstate, ExplainState *es)
static void
show_hash_info(HashState *hashstate, ExplainState *es)
{
- HashJoinTable hashtable;
+ HashInstrumentation *hinstrument = NULL;
- hashtable = hashstate->hashtable;
+ /*
+ * In a parallel query, the leader process may or may not have run the
+ * hash join, and even if it did it may not have built a hash table due to
+ * timing (if it started late it might have seen no tuples in the outer
+ * relation and skipped building the hash table). Therefore we have to be
+ * prepared to get instrumentation data from a worker if there is no hash
+ * table.
+ */
+ if (hashstate->hashtable)
+ {
+ hinstrument = (HashInstrumentation *)
+ palloc(sizeof(HashInstrumentation));
+ ExecHashGetInstrumentation(hinstrument, hashstate->hashtable);
+ }
+ else if (hashstate->shared_info)
+ {
+ SharedHashInfo *shared_info = hashstate->shared_info;
+ int i;
+
+ /* Find the first worker that built a hash table. */
+ for (i = 0; i < shared_info->num_workers; ++i)
+ {
+ if (shared_info->hinstrument[i].nbatch > 0)
+ {
+ hinstrument = &shared_info->hinstrument[i];
+ break;
+ }
+ }
+ }
- if (hashtable)
+ if (hinstrument)
{
- long spacePeakKb = (hashtable->spacePeak + 1023) / 1024;
+ long spacePeakKb = (hinstrument->space_peak + 1023) / 1024;
if (es->format != EXPLAIN_FORMAT_TEXT)
{
- ExplainPropertyLong("Hash Buckets", hashtable->nbuckets, es);
+ ExplainPropertyLong("Hash Buckets", hinstrument->nbuckets, es);
ExplainPropertyLong("Original Hash Buckets",
- hashtable->nbuckets_original, es);
- ExplainPropertyLong("Hash Batches", hashtable->nbatch, es);
+ hinstrument->nbuckets_original, es);
+ ExplainPropertyLong("Hash Batches", hinstrument->nbatch, es);
ExplainPropertyLong("Original Hash Batches",
- hashtable->nbatch_original, es);
+ hinstrument->nbatch_original, es);
ExplainPropertyLong("Peak Memory Usage", spacePeakKb, es);
}
- else if (hashtable->nbatch_original != hashtable->nbatch ||
- hashtable->nbuckets_original != hashtable->nbuckets)
+ else if (hinstrument->nbatch_original != hinstrument->nbatch ||
+ hinstrument->nbuckets_original != hinstrument->nbuckets)
{
appendStringInfoSpaces(es->str, es->indent * 2);
appendStringInfo(es->str,
"Buckets: %d (originally %d) Batches: %d (originally %d) Memory Usage: %ldkB\n",
- hashtable->nbuckets,
- hashtable->nbuckets_original,
- hashtable->nbatch,
- hashtable->nbatch_original,
+ hinstrument->nbuckets,
+ hinstrument->nbuckets_original,
+ hinstrument->nbatch,
+ hinstrument->nbatch_original,
spacePeakKb);
}
else
@@ -2414,7 +2442,7 @@ show_hash_info(HashState *hashstate, ExplainState *es)
appendStringInfoSpaces(es->str, es->indent * 2);
appendStringInfo(es->str,
"Buckets: %d Batches: %d Memory Usage: %ldkB\n",
- hashtable->nbuckets, hashtable->nbatch,
+ hinstrument->nbuckets, hinstrument->nbatch,
spacePeakKb);
}
}
diff --git a/src/backend/executor/execParallel.c b/src/backend/executor/execParallel.c
index 53c5254be13..f2adfb15ef5 100644
--- a/src/backend/executor/execParallel.c
+++ b/src/backend/executor/execParallel.c
@@ -29,6 +29,7 @@
#include "executor/nodeBitmapHeapscan.h"
#include "executor/nodeCustom.h"
#include "executor/nodeForeignscan.h"
+#include "executor/nodeHash.h"
#include "executor/nodeIndexscan.h"
#include "executor/nodeIndexonlyscan.h"
#include "executor/nodeSeqscan.h"
@@ -259,6 +260,10 @@ ExecParallelEstimate(PlanState *planstate, ExecParallelEstimateContext *e)
ExecBitmapHeapEstimate((BitmapHeapScanState *) planstate,
e->pcxt);
break;
+ case T_HashState:
+ /* even when not parallel-aware */
+ ExecHashEstimate((HashState *) planstate, e->pcxt);
+ break;
case T_SortState:
/* even when not parallel-aware */
ExecSortEstimate((SortState *) planstate, e->pcxt);
@@ -458,6 +463,10 @@ ExecParallelInitializeDSM(PlanState *planstate,
ExecBitmapHeapInitializeDSM((BitmapHeapScanState *) planstate,
d->pcxt);
break;
+ case T_HashState:
+ /* even when not parallel-aware */
+ ExecHashInitializeDSM((HashState *) planstate, d->pcxt);
+ break;
case T_SortState:
/* even when not parallel-aware */
ExecSortInitializeDSM((SortState *) planstate, d->pcxt);
@@ -928,12 +937,18 @@ ExecParallelRetrieveInstrumentation(PlanState *planstate,
planstate->worker_instrument->num_workers = instrumentation->num_workers;
memcpy(&planstate->worker_instrument->instrument, instrument, ibytes);
- /*
- * Perform any node-type-specific work that needs to be done. Currently,
- * only Sort nodes need to do anything here.
- */
- if (IsA(planstate, SortState))
- ExecSortRetrieveInstrumentation((SortState *) planstate);
+ /* Perform any node-type-specific work that needs to be done. */
+ switch (nodeTag(planstate))
+ {
+ case T_SortState:
+ ExecSortRetrieveInstrumentation((SortState *) planstate);
+ break;
+ case T_HashState:
+ ExecHashRetrieveInstrumentation((HashState *) planstate);
+ break;
+ default:
+ break;
+ }
return planstate_tree_walker(planstate, ExecParallelRetrieveInstrumentation,
instrumentation);
@@ -1160,6 +1175,10 @@ ExecParallelInitializeWorker(PlanState *planstate, ParallelWorkerContext *pwcxt)
ExecBitmapHeapInitializeWorker((BitmapHeapScanState *) planstate,
pwcxt);
break;
+ case T_HashState:
+ /* even when not parallel-aware */
+ ExecHashInitializeWorker((HashState *) planstate, pwcxt);
+ break;
case T_SortState:
/* even when not parallel-aware */
ExecSortInitializeWorker((SortState *) planstate, pwcxt);
diff --git a/src/backend/executor/execProcnode.c b/src/backend/executor/execProcnode.c
index c1aa5064c90..9befca90161 100644
--- a/src/backend/executor/execProcnode.c
+++ b/src/backend/executor/execProcnode.c
@@ -751,6 +751,9 @@ ExecShutdownNode(PlanState *node)
case T_GatherMergeState:
ExecShutdownGatherMerge((GatherMergeState *) node);
break;
+ case T_HashState:
+ ExecShutdownHash((HashState *) node);
+ break;
default:
break;
}
diff --git a/src/backend/executor/nodeHash.c b/src/backend/executor/nodeHash.c
index f7cd8fb3472..afd7384e945 100644
--- a/src/backend/executor/nodeHash.c
+++ b/src/backend/executor/nodeHash.c
@@ -1637,6 +1637,97 @@ ExecHashRemoveNextSkewBucket(HashJoinTable hashtable)
}
}
+/*
+ * Reserve space in the DSM segment for instrumentation data.
+ */
+void
+ExecHashEstimate(HashState *node, ParallelContext *pcxt)
+{
+ size_t size;
+
+ size = mul_size(pcxt->nworkers, sizeof(HashInstrumentation));
+ size = add_size(size, offsetof(SharedHashInfo, hinstrument));
+ shm_toc_estimate_chunk(&pcxt->estimator, size);
+ shm_toc_estimate_keys(&pcxt->estimator, 1);
+}
+
+/*
+ * Set up a space in the DSM for all workers to record instrumentation data
+ * about their hash table.
+ */
+void
+ExecHashInitializeDSM(HashState *node, ParallelContext *pcxt)
+{
+ size_t size;
+
+ size = offsetof(SharedHashInfo, hinstrument) +
+ pcxt->nworkers * sizeof(HashInstrumentation);
+ node->shared_info = (SharedHashInfo *) shm_toc_allocate(pcxt->toc, size);
+ memset(node->shared_info, 0, size);
+ node->shared_info->num_workers = pcxt->nworkers;
+ shm_toc_insert(pcxt->toc, node->ps.plan->plan_node_id,
+ node->shared_info);
+}
+
+/*
+ * Locate the DSM space for hash table instrumentation data that we'll write
+ * to at shutdown time.
+ */
+void
+ExecHashInitializeWorker(HashState *node, ParallelWorkerContext *pwcxt)
+{
+ SharedHashInfo *shared_info;
+
+ shared_info = (SharedHashInfo *)
+ shm_toc_lookup(pwcxt->toc, node->ps.plan->plan_node_id, true);
+ node->hinstrument = &shared_info->hinstrument[ParallelWorkerNumber];
+}
+
+/*
+ * Copy instrumentation data from this worker's hash table (if it built one)
+ * to DSM memory so the leader can retrieve it. This must be done in an
+ * ExecShutdownHash() rather than ExecEndHash() because the latter runs after
+ * we've detached from the DSM segment.
+ */
+void
+ExecShutdownHash(HashState *node)
+{
+ if (node->hinstrument && node->hashtable)
+ ExecHashGetInstrumentation(node->hinstrument, node->hashtable);
+}
+
+/*
+ * Retrieve instrumentation data from workers before the DSM segment is
+ * detached, so that EXPLAIN can access it.
+ */
+void
+ExecHashRetrieveInstrumentation(HashState *node)
+{
+ SharedHashInfo *shared_info = node->shared_info;
+ size_t size;
+
+ /* Replace node->shared_info with a copy in backend-local memory. */
+ size = offsetof(SharedHashInfo, hinstrument) +
+ shared_info->num_workers * sizeof(HashInstrumentation);
+ node->shared_info = palloc(size);
+ memcpy(node->shared_info, shared_info, size);
+}
+
+/*
+ * Copy the instrumentation data from 'hashtable' into a HashInstrumentation
+ * struct.
+ */
+void
+ExecHashGetInstrumentation(HashInstrumentation *instrument,
+ HashJoinTable hashtable)
+{
+ instrument->nbuckets = hashtable->nbuckets;
+ instrument->nbuckets_original = hashtable->nbuckets_original;
+ instrument->nbatch = hashtable->nbatch;
+ instrument->nbatch_original = hashtable->nbatch_original;
+ instrument->space_peak = hashtable->spacePeak;
+}
+
/*
* Allocate 'size' bytes from the currently active HashMemoryChunk
*/
diff --git a/src/include/executor/nodeHash.h b/src/include/executor/nodeHash.h
index 3ae556fb6c5..0974f1edc21 100644
--- a/src/include/executor/nodeHash.h
+++ b/src/include/executor/nodeHash.h
@@ -14,6 +14,7 @@
#ifndef NODEHASH_H
#define NODEHASH_H
+#include "access/parallel.h"
#include "nodes/execnodes.h"
extern HashState *ExecInitHash(Hash *node, EState *estate, int eflags);
@@ -48,5 +49,12 @@ extern void ExecChooseHashTableSize(double ntuples, int tupwidth, bool useskew,
int *numbatches,
int *num_skew_mcvs);
extern int ExecHashGetSkewBucket(HashJoinTable hashtable, uint32 hashvalue);
+extern void ExecHashEstimate(HashState *node, ParallelContext *pcxt);
+extern void ExecHashInitializeDSM(HashState *node, ParallelContext *pcxt);
+extern void ExecHashInitializeWorker(HashState *node, ParallelWorkerContext *pwcxt);
+extern void ExecHashRetrieveInstrumentation(HashState *node);
+extern void ExecShutdownHash(HashState *node);
+extern void ExecHashGetInstrumentation(HashInstrumentation *instrument,
+ HashJoinTable hashtable);
#endif /* NODEHASH_H */
diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h
index e05bc04f525..6c322e57c00 100644
--- a/src/include/nodes/execnodes.h
+++ b/src/include/nodes/execnodes.h
@@ -1980,6 +1980,29 @@ typedef struct GatherMergeState
struct binaryheap *gm_heap; /* binary heap of slot indices */
} GatherMergeState;
+/* ----------------
+ * Values displayed by EXPLAIN ANALYZE
+ * ----------------
+ */
+typedef struct HashInstrumentation
+{
+ int nbuckets;
+ int nbuckets_original;
+ int nbatch;
+ int nbatch_original;
+ size_t space_peak;
+} HashInstrumentation;
+
+/* ----------------
+ * Shared memory container for per-worker hash information
+ * ----------------
+ */
+typedef struct SharedHashInfo
+{
+ int num_workers;
+ HashInstrumentation hinstrument[FLEXIBLE_ARRAY_MEMBER];
+} SharedHashInfo;
+
/* ----------------
* HashState information
* ----------------
@@ -1990,6 +2013,9 @@ typedef struct HashState
HashJoinTable hashtable; /* hash table for the hashjoin */
List *hashkeys; /* list of ExprState nodes */
/* hashkeys is same as parent's hj_InnerHashKeys */
+
+ SharedHashInfo *shared_info; /* one entry per worker */
+ HashInstrumentation *hinstrument; /* this worker's entry */
} HashState;
/* ----------------
diff --git a/src/test/regress/expected/join.out b/src/test/regress/expected/join.out
index b7d17900978..001d96dc2d8 100644
--- a/src/test/regress/expected/join.out
+++ b/src/test/regress/expected/join.out
@@ -6173,6 +6173,21 @@ $$);
rollback to settings;
-- A couple of other hash join tests unrelated to work_mem management.
+-- Check that EXPLAIN ANALYZE has data even if the leader doesn't participate
+savepoint settings;
+set local max_parallel_workers_per_gather = 2;
+set local work_mem = '4MB';
+set local parallel_leader_participation = off;
+select * from hash_join_batches(
+$$
+ select count(*) from simple r join simple s using (id);
+$$);
+ original | final
+----------+-------
+ 1 | 1
+(1 row)
+
+rollback to settings;
-- A full outer join where every record is matched.
-- non-parallel
savepoint settings;
diff --git a/src/test/regress/sql/join.sql b/src/test/regress/sql/join.sql
index c6d4a513e86..882601b3388 100644
--- a/src/test/regress/sql/join.sql
+++ b/src/test/regress/sql/join.sql
@@ -2159,6 +2159,17 @@ rollback to settings;
-- A couple of other hash join tests unrelated to work_mem management.
+-- Check that EXPLAIN ANALYZE has data even if the leader doesn't participate
+savepoint settings;
+set local max_parallel_workers_per_gather = 2;
+set local work_mem = '4MB';
+set local parallel_leader_participation = off;
+select * from hash_join_batches(
+$$
+ select count(*) from simple r join simple s using (id);
+$$);
+rollback to settings;
+
-- A full outer join where every record is matched.
-- non-parallel
--
2.15.0
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: pgsql: Add some regression tests that exercise hash join code.
2017-11-30 00:16 pgsql: Add some regression tests that exercise hash join code. Andres Freund <andres@anarazel.de>
2017-11-30 03:13 ` Re: pgsql: Add some regression tests that exercise hash join code. Tom Lane <tgl@sss.pgh.pa.us>
2017-11-30 03:47 ` Re: pgsql: Add some regression tests that exercise hash join code. Thomas Munro <thomas.munro@enterprisedb.com>
2017-11-30 10:53 ` Re: pgsql: Add some regression tests that exercise hash join code. Thomas Munro <thomas.munro@enterprisedb.com>
2017-11-30 16:06 ` Re: pgsql: Add some regression tests that exercise hash join code. Andres Freund <andres@anarazel.de>
2017-12-03 18:39 ` Re: pgsql: Add some regression tests that exercise hash join code. Andres Freund <andres@anarazel.de>
2017-12-03 20:12 ` Re: pgsql: Add some regression tests that exercise hash join code. Thomas Munro <thomas.munro@enterprisedb.com>
2017-12-03 23:18 ` Re: pgsql: Add some regression tests that exercise hash join code. Thomas Munro <thomas.munro@enterprisedb.com>
2017-12-03 23:28 ` Re: pgsql: Add some regression tests that exercise hash join code. Thomas Munro <thomas.munro@enterprisedb.com>
@ 2017-12-04 20:21 ` Andres Freund <andres@anarazel.de>
2017-12-04 23:59 ` Re: pgsql: Add some regression tests that exercise hash join code. Thomas Munro <thomas.munro@enterprisedb.com>
0 siblings, 1 reply; 13+ messages in thread
From: Andres Freund @ 2017-12-04 20:21 UTC (permalink / raw)
To: Thomas Munro <thomas.munro@enterprisedb.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; pgsql-committers
On 2017-12-04 12:28:56 +1300, Thomas Munro wrote:
> From 43eeea0bc35204440d262224b56efca958b33428 Mon Sep 17 00:00:00 2001
> From: Thomas Munro <thomas.munro@enterprisedb.com>
> Date: Mon, 4 Dec 2017 11:52:11 +1300
> Subject: [PATCH] Fix EXPLAIN ANALYZE of hash join when the leader doesn't
> execute.
>
> If a hash join appears in a parallel query, there may be no hash table
> available for explain.c to inspect even though a hash table may have been
> built in other processes. This could happen either because
> parallel_leader_participation was set to off or because the leader happened to
> hit the end of the outer relation immediately (even though the complete
> relation is not empty) and decided not to build the hash table.
>
> Commit bf11e7ee introduced a way for workers to exchange instrumentation via
> the DSM segment for Sort nodes even though they are not parallel-aware. This
> commit does the same for Hash nodes, so that explain.c has a way to find
> instrumentation data from an arbitrary participant that actually built the
> hash table.
Makes sense. Seems ok to only fix this inv11, even if present earlier.
> diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c
> index 447f69d044e..1ffe635d66c 100644
> --- a/src/backend/commands/explain.c
> +++ b/src/backend/commands/explain.c
> @@ -2379,34 +2379,62 @@ show_sort_info(SortState *sortstate, ExplainState *es)
> static void
> show_hash_info(HashState *hashstate, ExplainState *es)
> {
> - HashJoinTable hashtable;
> + HashInstrumentation *hinstrument = NULL;
>
> - hashtable = hashstate->hashtable;
> + /*
> + * In a parallel query, the leader process may or may not have run the
> + * hash join, and even if it did it may not have built a hash table due to
> + * timing (if it started late it might have seen no tuples in the outer
> + * relation and skipped building the hash table). Therefore we have to be
> + * prepared to get instrumentation data from a worker if there is no hash
> + * table.
> + */
> + if (hashstate->hashtable)
> + {
> + hinstrument = (HashInstrumentation *)
> + palloc(sizeof(HashInstrumentation));
> + ExecHashGetInstrumentation(hinstrument, hashstate->hashtable);
> + }
> + else if (hashstate->shared_info)
> + {
> + SharedHashInfo *shared_info = hashstate->shared_info;
> + int i;
> +
> + /* Find the first worker that built a hash table. */
> + for (i = 0; i < shared_info->num_workers; ++i)
> + {
> + if (shared_info->hinstrument[i].nbatch > 0)
> + {
> + hinstrument = &shared_info->hinstrument[i];
> + break;
> + }
> + }
> + }
I can't think of a way that, before the parallel HJ patch, results in a
difference between the size of the hashtable between workers. Short of
some participant not having a hashtable at all, that is. Wwe also don't
currently display lookup information etc. So just more or less randomly
choosing one worker's seems ok.
> + case T_HashState:
> + /* even when not parallel-aware */
"..., for stats" or such maybe?
> + ExecHashEstimate((HashState *) planstate, e->pcxt);
> + break;
> case T_SortState:
> /* even when not parallel-aware */
I'd just update that comment as well.
> #endif /* NODEHASH_H */
> diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h
> index e05bc04f525..6c322e57c00 100644
> --- a/src/include/nodes/execnodes.h
> +++ b/src/include/nodes/execnodes.h
> @@ -1980,6 +1980,29 @@ typedef struct GatherMergeState
> struct binaryheap *gm_heap; /* binary heap of slot indices */
> } GatherMergeState;
>
> +/* ----------------
> + * Values displayed by EXPLAIN ANALYZE
> + * ----------------
> + */
> +typedef struct HashInstrumentation
> +{
> + int nbuckets;
> + int nbuckets_original;
> + int nbatch;
> + int nbatch_original;
> + size_t space_peak;
> +} HashInstrumentation;
Maybe I'm being pedantic here, but I think it'd not hurt to explain what
these mean. It's obviously pretty clear what nbuckets/batch mean, but
the difference between original and not is far less clea.r
Looks reasonable these nitpicks aside.
Greetings,
Andres Freund
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: pgsql: Add some regression tests that exercise hash join code.
2017-11-30 00:16 pgsql: Add some regression tests that exercise hash join code. Andres Freund <andres@anarazel.de>
2017-11-30 03:13 ` Re: pgsql: Add some regression tests that exercise hash join code. Tom Lane <tgl@sss.pgh.pa.us>
2017-11-30 03:47 ` Re: pgsql: Add some regression tests that exercise hash join code. Thomas Munro <thomas.munro@enterprisedb.com>
2017-11-30 10:53 ` Re: pgsql: Add some regression tests that exercise hash join code. Thomas Munro <thomas.munro@enterprisedb.com>
2017-11-30 16:06 ` Re: pgsql: Add some regression tests that exercise hash join code. Andres Freund <andres@anarazel.de>
2017-12-03 18:39 ` Re: pgsql: Add some regression tests that exercise hash join code. Andres Freund <andres@anarazel.de>
2017-12-03 20:12 ` Re: pgsql: Add some regression tests that exercise hash join code. Thomas Munro <thomas.munro@enterprisedb.com>
2017-12-03 23:18 ` Re: pgsql: Add some regression tests that exercise hash join code. Thomas Munro <thomas.munro@enterprisedb.com>
2017-12-03 23:28 ` Re: pgsql: Add some regression tests that exercise hash join code. Thomas Munro <thomas.munro@enterprisedb.com>
2017-12-04 20:21 ` Re: pgsql: Add some regression tests that exercise hash join code. Andres Freund <andres@anarazel.de>
@ 2017-12-04 23:59 ` Thomas Munro <thomas.munro@enterprisedb.com>
2017-12-05 19:03 ` Re: pgsql: Add some regression tests that exercise hash join code. Andres Freund <andres@anarazel.de>
0 siblings, 1 reply; 13+ messages in thread
From: Thomas Munro @ 2017-12-04 23:59 UTC (permalink / raw)
To: Andres Freund <andres@anarazel.de>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; pgsql-committers
On Tue, Dec 5, 2017 at 9:21 AM, Andres Freund <andres@anarazel.de> wrote:
> On 2017-12-04 12:28:56 +1300, Thomas Munro wrote:
>> From 43eeea0bc35204440d262224b56efca958b33428 Mon Sep 17 00:00:00 2001
>> From: Thomas Munro <thomas.munro@enterprisedb.com>
>> Date: Mon, 4 Dec 2017 11:52:11 +1300
>> Subject: [PATCH] Fix EXPLAIN ANALYZE of hash join when the leader doesn't
>> execute.
>>
>> If a hash join appears in a parallel query, there may be no hash table
>> available for explain.c to inspect even though a hash table may have been
>> built in other processes. This could happen either because
>> parallel_leader_participation was set to off or because the leader happened to
>> hit the end of the outer relation immediately (even though the complete
>> relation is not empty) and decided not to build the hash table.
>>
>> Commit bf11e7ee introduced a way for workers to exchange instrumentation via
>> the DSM segment for Sort nodes even though they are not parallel-aware. This
>> commit does the same for Hash nodes, so that explain.c has a way to find
>> instrumentation data from an arbitrary participant that actually built the
>> hash table.
>
> Makes sense. Seems ok to only fix this inv11, even if present earlier.
+1
I doubt any v10 users will notice. v11 makes it more noticeable
because it has the new parallel_leader_participation GUC and these new
regression tests which hit the racy case surprisingly often when
running on somebody's toaster in the buildfarm.
> I can't think of a way that, before the parallel HJ patch, results in a
> difference between the size of the hashtable between workers. Short of
> some participant not having a hashtable at all, that is. Wwe also don't
> currently display lookup information etc. So just more or less randomly
> choosing one worker's seems ok.
Right. Finding the first arbitrary backend that actually built the
hash table and using its instrumentation data works OK for now because
they each do either exactly the same hash build or nothing. Even with
the later PHJ patch the batch/buckets sizing info will always be the
same across all workers that built the hash table, so it just needs
some special handling to choose what peak size to report (or some more
elaborate information on space usage, to be bikeshedded later).
>> + case T_HashState:
>> + /* even when not parallel-aware */
>
> "..., for stats" or such maybe?
How about ", for EXPLAIN ANALYZE"? Done that way.
>> + ExecHashEstimate((HashState *) planstate, e->pcxt);
>> + break;
>> case T_SortState:
>> /* even when not parallel-aware */
>
> I'd just update that comment as well.
Done.
Looking for all the places where Robert has that comment, I realised
that I probably also needed to supply ExecHashReInitializeDSM() to zap
the instrumentation array for each loop. Done.
>> +/* ----------------
>> + * Values displayed by EXPLAIN ANALYZE
>> + * ----------------
>> + */
>> +typedef struct HashInstrumentation
>> +{
>> + int nbuckets;
>> + int nbuckets_original;
>> + int nbatch;
>> + int nbatch_original;
>> + size_t space_peak;
>> +} HashInstrumentation;
>
> Maybe I'm being pedantic here, but I think it'd not hurt to explain what
> these mean. It's obviously pretty clear what nbuckets/batch mean, but
> the difference between original and not is far less clea.r
Fixed.
--
Thomas Munro
http://www.enterprisedb.com
Attachments:
fix-explain-analyze-hash-join-v3.patch (application/octet-stream, 16.2K) download
From 2145e9070f81301128ad1f3b76ffa46483b51415 Mon Sep 17 00:00:00 2001
From: Thomas Munro <thomas.munro@enterprisedb.com>
Date: Mon, 4 Dec 2017 11:52:11 +1300
Subject: [PATCH] Fix EXPLAIN ANALYZE of hash join when the leader doesn't
execute.
If a hash join appears in a parallel query, there may be no hash table
available for explain.c to inspect even though a hash table may have been
built in other processes. This could happen either because
parallel_leader_participation was set to off or because the leader happened to
hit the end of the outer relation immediately (even though the complete
relation is not empty) and decided not to build the hash table.
Commit bf11e7ee introduced a way for workers to exchange instrumentation via
the DSM segment for Sort nodes even though they are not parallel-aware. This
commit does the same for Hash nodes, so that explain.c has a way to find
instrumentation data from an arbitrary participant that actually built the
hash table.
Author: Thomas Munro
Reviewed-By: Andres Freund
Discussion: https://postgr.es/m/CAEepm%3D3DUQC2-z252N55eOcZBer6DPdM%3DFzrxH9dZc5vYLsjaA%40mail.gmail.com
---
src/backend/commands/explain.c | 58 ++++++++++++++------
src/backend/executor/execParallel.c | 43 +++++++++++----
src/backend/executor/execProcnode.c | 3 ++
src/backend/executor/nodeHash.c | 104 ++++++++++++++++++++++++++++++++++++
src/include/executor/nodeHash.h | 9 ++++
src/include/nodes/execnodes.h | 26 +++++++++
src/test/regress/expected/join.out | 15 ++++++
src/test/regress/sql/join.sql | 11 ++++
8 files changed, 244 insertions(+), 25 deletions(-)
diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c
index 447f69d044e..1ffe635d66c 100644
--- a/src/backend/commands/explain.c
+++ b/src/backend/commands/explain.c
@@ -2379,34 +2379,62 @@ show_sort_info(SortState *sortstate, ExplainState *es)
static void
show_hash_info(HashState *hashstate, ExplainState *es)
{
- HashJoinTable hashtable;
+ HashInstrumentation *hinstrument = NULL;
- hashtable = hashstate->hashtable;
+ /*
+ * In a parallel query, the leader process may or may not have run the
+ * hash join, and even if it did it may not have built a hash table due to
+ * timing (if it started late it might have seen no tuples in the outer
+ * relation and skipped building the hash table). Therefore we have to be
+ * prepared to get instrumentation data from a worker if there is no hash
+ * table.
+ */
+ if (hashstate->hashtable)
+ {
+ hinstrument = (HashInstrumentation *)
+ palloc(sizeof(HashInstrumentation));
+ ExecHashGetInstrumentation(hinstrument, hashstate->hashtable);
+ }
+ else if (hashstate->shared_info)
+ {
+ SharedHashInfo *shared_info = hashstate->shared_info;
+ int i;
+
+ /* Find the first worker that built a hash table. */
+ for (i = 0; i < shared_info->num_workers; ++i)
+ {
+ if (shared_info->hinstrument[i].nbatch > 0)
+ {
+ hinstrument = &shared_info->hinstrument[i];
+ break;
+ }
+ }
+ }
- if (hashtable)
+ if (hinstrument)
{
- long spacePeakKb = (hashtable->spacePeak + 1023) / 1024;
+ long spacePeakKb = (hinstrument->space_peak + 1023) / 1024;
if (es->format != EXPLAIN_FORMAT_TEXT)
{
- ExplainPropertyLong("Hash Buckets", hashtable->nbuckets, es);
+ ExplainPropertyLong("Hash Buckets", hinstrument->nbuckets, es);
ExplainPropertyLong("Original Hash Buckets",
- hashtable->nbuckets_original, es);
- ExplainPropertyLong("Hash Batches", hashtable->nbatch, es);
+ hinstrument->nbuckets_original, es);
+ ExplainPropertyLong("Hash Batches", hinstrument->nbatch, es);
ExplainPropertyLong("Original Hash Batches",
- hashtable->nbatch_original, es);
+ hinstrument->nbatch_original, es);
ExplainPropertyLong("Peak Memory Usage", spacePeakKb, es);
}
- else if (hashtable->nbatch_original != hashtable->nbatch ||
- hashtable->nbuckets_original != hashtable->nbuckets)
+ else if (hinstrument->nbatch_original != hinstrument->nbatch ||
+ hinstrument->nbuckets_original != hinstrument->nbuckets)
{
appendStringInfoSpaces(es->str, es->indent * 2);
appendStringInfo(es->str,
"Buckets: %d (originally %d) Batches: %d (originally %d) Memory Usage: %ldkB\n",
- hashtable->nbuckets,
- hashtable->nbuckets_original,
- hashtable->nbatch,
- hashtable->nbatch_original,
+ hinstrument->nbuckets,
+ hinstrument->nbuckets_original,
+ hinstrument->nbatch,
+ hinstrument->nbatch_original,
spacePeakKb);
}
else
@@ -2414,7 +2442,7 @@ show_hash_info(HashState *hashstate, ExplainState *es)
appendStringInfoSpaces(es->str, es->indent * 2);
appendStringInfo(es->str,
"Buckets: %d Batches: %d Memory Usage: %ldkB\n",
- hashtable->nbuckets, hashtable->nbatch,
+ hinstrument->nbuckets, hinstrument->nbatch,
spacePeakKb);
}
}
diff --git a/src/backend/executor/execParallel.c b/src/backend/executor/execParallel.c
index 53c5254be13..0aca00b0e68 100644
--- a/src/backend/executor/execParallel.c
+++ b/src/backend/executor/execParallel.c
@@ -29,6 +29,7 @@
#include "executor/nodeBitmapHeapscan.h"
#include "executor/nodeCustom.h"
#include "executor/nodeForeignscan.h"
+#include "executor/nodeHash.h"
#include "executor/nodeIndexscan.h"
#include "executor/nodeIndexonlyscan.h"
#include "executor/nodeSeqscan.h"
@@ -259,8 +260,12 @@ ExecParallelEstimate(PlanState *planstate, ExecParallelEstimateContext *e)
ExecBitmapHeapEstimate((BitmapHeapScanState *) planstate,
e->pcxt);
break;
+ case T_HashState:
+ /* even when not parallel-aware, for EXPLAIN ANALYZE */
+ ExecHashEstimate((HashState *) planstate, e->pcxt);
+ break;
case T_SortState:
- /* even when not parallel-aware */
+ /* even when not parallel-aware, for EXPLAIN ANALYZE */
ExecSortEstimate((SortState *) planstate, e->pcxt);
break;
@@ -458,8 +463,12 @@ ExecParallelInitializeDSM(PlanState *planstate,
ExecBitmapHeapInitializeDSM((BitmapHeapScanState *) planstate,
d->pcxt);
break;
+ case T_HashState:
+ /* even when not parallel-aware, for EXPLAIN ANALYZE */
+ ExecHashInitializeDSM((HashState *) planstate, d->pcxt);
+ break;
case T_SortState:
- /* even when not parallel-aware */
+ /* even when not parallel-aware, for EXPLAIN ANALYZE */
ExecSortInitializeDSM((SortState *) planstate, d->pcxt);
break;
@@ -872,8 +881,12 @@ ExecParallelReInitializeDSM(PlanState *planstate,
ExecBitmapHeapReInitializeDSM((BitmapHeapScanState *) planstate,
pcxt);
break;
+ case T_HashState:
+ /* even when not parallel-aware, for EXPLAIN ANALYZE */
+ ExecHashReInitializeDSM((HashState *) planstate, pcxt);
+ break;
case T_SortState:
- /* even when not parallel-aware */
+ /* even when not parallel-aware, for EXPLAIN ANALYZE */
ExecSortReInitializeDSM((SortState *) planstate, pcxt);
break;
@@ -928,12 +941,18 @@ ExecParallelRetrieveInstrumentation(PlanState *planstate,
planstate->worker_instrument->num_workers = instrumentation->num_workers;
memcpy(&planstate->worker_instrument->instrument, instrument, ibytes);
- /*
- * Perform any node-type-specific work that needs to be done. Currently,
- * only Sort nodes need to do anything here.
- */
- if (IsA(planstate, SortState))
- ExecSortRetrieveInstrumentation((SortState *) planstate);
+ /* Perform any node-type-specific work that needs to be done. */
+ switch (nodeTag(planstate))
+ {
+ case T_SortState:
+ ExecSortRetrieveInstrumentation((SortState *) planstate);
+ break;
+ case T_HashState:
+ ExecHashRetrieveInstrumentation((HashState *) planstate);
+ break;
+ default:
+ break;
+ }
return planstate_tree_walker(planstate, ExecParallelRetrieveInstrumentation,
instrumentation);
@@ -1160,8 +1179,12 @@ ExecParallelInitializeWorker(PlanState *planstate, ParallelWorkerContext *pwcxt)
ExecBitmapHeapInitializeWorker((BitmapHeapScanState *) planstate,
pwcxt);
break;
+ case T_HashState:
+ /* even when not parallel-aware, for EXPLAIN ANALYZE */
+ ExecHashInitializeWorker((HashState *) planstate, pwcxt);
+ break;
case T_SortState:
- /* even when not parallel-aware */
+ /* even when not parallel-aware, for EXPLAIN ANALYZE */
ExecSortInitializeWorker((SortState *) planstate, pwcxt);
break;
diff --git a/src/backend/executor/execProcnode.c b/src/backend/executor/execProcnode.c
index c1aa5064c90..9befca90161 100644
--- a/src/backend/executor/execProcnode.c
+++ b/src/backend/executor/execProcnode.c
@@ -751,6 +751,9 @@ ExecShutdownNode(PlanState *node)
case T_GatherMergeState:
ExecShutdownGatherMerge((GatherMergeState *) node);
break;
+ case T_HashState:
+ ExecShutdownHash((HashState *) node);
+ break;
default:
break;
}
diff --git a/src/backend/executor/nodeHash.c b/src/backend/executor/nodeHash.c
index f7cd8fb3472..6fe5d69d558 100644
--- a/src/backend/executor/nodeHash.c
+++ b/src/backend/executor/nodeHash.c
@@ -1637,6 +1637,110 @@ ExecHashRemoveNextSkewBucket(HashJoinTable hashtable)
}
}
+/*
+ * Reserve space in the DSM segment for instrumentation data.
+ */
+void
+ExecHashEstimate(HashState *node, ParallelContext *pcxt)
+{
+ size_t size;
+
+ size = mul_size(pcxt->nworkers, sizeof(HashInstrumentation));
+ size = add_size(size, offsetof(SharedHashInfo, hinstrument));
+ shm_toc_estimate_chunk(&pcxt->estimator, size);
+ shm_toc_estimate_keys(&pcxt->estimator, 1);
+}
+
+/*
+ * Set up a space in the DSM for all workers to record instrumentation data
+ * about their hash table.
+ */
+void
+ExecHashInitializeDSM(HashState *node, ParallelContext *pcxt)
+{
+ size_t size;
+
+ size = offsetof(SharedHashInfo, hinstrument) +
+ pcxt->nworkers * sizeof(HashInstrumentation);
+ node->shared_info = (SharedHashInfo *) shm_toc_allocate(pcxt->toc, size);
+ memset(node->shared_info, 0, size);
+ node->shared_info->num_workers = pcxt->nworkers;
+ shm_toc_insert(pcxt->toc, node->ps.plan->plan_node_id,
+ node->shared_info);
+}
+
+/*
+ * Reset shared state before beginning a fresh scan.
+ */
+void
+ExecHashReInitializeDSM(HashState *node, ParallelContext *pcxt)
+{
+ if (node->shared_info != NULL)
+ {
+ memset(node->shared_info->hinstrument, 0,
+ node->shared_info->num_workers * sizeof(HashInstrumentation));
+ }
+}
+
+/*
+ * Locate the DSM space for hash table instrumentation data that we'll write
+ * to at shutdown time.
+ */
+void
+ExecHashInitializeWorker(HashState *node, ParallelWorkerContext *pwcxt)
+{
+ SharedHashInfo *shared_info;
+
+ shared_info = (SharedHashInfo *)
+ shm_toc_lookup(pwcxt->toc, node->ps.plan->plan_node_id, true);
+ node->hinstrument = &shared_info->hinstrument[ParallelWorkerNumber];
+}
+
+/*
+ * Copy instrumentation data from this worker's hash table (if it built one)
+ * to DSM memory so the leader can retrieve it. This must be done in an
+ * ExecShutdownHash() rather than ExecEndHash() because the latter runs after
+ * we've detached from the DSM segment.
+ */
+void
+ExecShutdownHash(HashState *node)
+{
+ if (node->hinstrument && node->hashtable)
+ ExecHashGetInstrumentation(node->hinstrument, node->hashtable);
+}
+
+/*
+ * Retrieve instrumentation data from workers before the DSM segment is
+ * detached, so that EXPLAIN can access it.
+ */
+void
+ExecHashRetrieveInstrumentation(HashState *node)
+{
+ SharedHashInfo *shared_info = node->shared_info;
+ size_t size;
+
+ /* Replace node->shared_info with a copy in backend-local memory. */
+ size = offsetof(SharedHashInfo, hinstrument) +
+ shared_info->num_workers * sizeof(HashInstrumentation);
+ node->shared_info = palloc(size);
+ memcpy(node->shared_info, shared_info, size);
+}
+
+/*
+ * Copy the instrumentation data from 'hashtable' into a HashInstrumentation
+ * struct.
+ */
+void
+ExecHashGetInstrumentation(HashInstrumentation *instrument,
+ HashJoinTable hashtable)
+{
+ instrument->nbuckets = hashtable->nbuckets;
+ instrument->nbuckets_original = hashtable->nbuckets_original;
+ instrument->nbatch = hashtable->nbatch;
+ instrument->nbatch_original = hashtable->nbatch_original;
+ instrument->space_peak = hashtable->spacePeak;
+}
+
/*
* Allocate 'size' bytes from the currently active HashMemoryChunk
*/
diff --git a/src/include/executor/nodeHash.h b/src/include/executor/nodeHash.h
index 3ae556fb6c5..75d4c70f6f6 100644
--- a/src/include/executor/nodeHash.h
+++ b/src/include/executor/nodeHash.h
@@ -14,6 +14,7 @@
#ifndef NODEHASH_H
#define NODEHASH_H
+#include "access/parallel.h"
#include "nodes/execnodes.h"
extern HashState *ExecInitHash(Hash *node, EState *estate, int eflags);
@@ -48,5 +49,13 @@ extern void ExecChooseHashTableSize(double ntuples, int tupwidth, bool useskew,
int *numbatches,
int *num_skew_mcvs);
extern int ExecHashGetSkewBucket(HashJoinTable hashtable, uint32 hashvalue);
+extern void ExecHashEstimate(HashState *node, ParallelContext *pcxt);
+extern void ExecHashInitializeDSM(HashState *node, ParallelContext *pcxt);
+extern void ExecHashInitializeWorker(HashState *node, ParallelWorkerContext *pwcxt);
+extern void ExecHashReInitializeDSM(HashState *node, ParallelContext *pcxt);
+extern void ExecHashRetrieveInstrumentation(HashState *node);
+extern void ExecShutdownHash(HashState *node);
+extern void ExecHashGetInstrumentation(HashInstrumentation *instrument,
+ HashJoinTable hashtable);
#endif /* NODEHASH_H */
diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h
index e05bc04f525..084d59ef834 100644
--- a/src/include/nodes/execnodes.h
+++ b/src/include/nodes/execnodes.h
@@ -1980,6 +1980,29 @@ typedef struct GatherMergeState
struct binaryheap *gm_heap; /* binary heap of slot indices */
} GatherMergeState;
+/* ----------------
+ * Values displayed by EXPLAIN ANALYZE
+ * ----------------
+ */
+typedef struct HashInstrumentation
+{
+ int nbuckets; /* number of buckets at end of execution */
+ int nbuckets_original; /* planned number of buckets */
+ int nbatch; /* number of batches at end of execution */
+ int nbatch_original; /* planned number of batches */
+ size_t space_peak; /* speak memory usage in bytes */
+} HashInstrumentation;
+
+/* ----------------
+ * Shared memory container for per-worker hash information
+ * ----------------
+ */
+typedef struct SharedHashInfo
+{
+ int num_workers;
+ HashInstrumentation hinstrument[FLEXIBLE_ARRAY_MEMBER];
+} SharedHashInfo;
+
/* ----------------
* HashState information
* ----------------
@@ -1990,6 +2013,9 @@ typedef struct HashState
HashJoinTable hashtable; /* hash table for the hashjoin */
List *hashkeys; /* list of ExprState nodes */
/* hashkeys is same as parent's hj_InnerHashKeys */
+
+ SharedHashInfo *shared_info; /* one entry per worker */
+ HashInstrumentation *hinstrument; /* this worker's entry */
} HashState;
/* ----------------
diff --git a/src/test/regress/expected/join.out b/src/test/regress/expected/join.out
index b7d17900978..001d96dc2d8 100644
--- a/src/test/regress/expected/join.out
+++ b/src/test/regress/expected/join.out
@@ -6173,6 +6173,21 @@ $$);
rollback to settings;
-- A couple of other hash join tests unrelated to work_mem management.
+-- Check that EXPLAIN ANALYZE has data even if the leader doesn't participate
+savepoint settings;
+set local max_parallel_workers_per_gather = 2;
+set local work_mem = '4MB';
+set local parallel_leader_participation = off;
+select * from hash_join_batches(
+$$
+ select count(*) from simple r join simple s using (id);
+$$);
+ original | final
+----------+-------
+ 1 | 1
+(1 row)
+
+rollback to settings;
-- A full outer join where every record is matched.
-- non-parallel
savepoint settings;
diff --git a/src/test/regress/sql/join.sql b/src/test/regress/sql/join.sql
index c6d4a513e86..882601b3388 100644
--- a/src/test/regress/sql/join.sql
+++ b/src/test/regress/sql/join.sql
@@ -2159,6 +2159,17 @@ rollback to settings;
-- A couple of other hash join tests unrelated to work_mem management.
+-- Check that EXPLAIN ANALYZE has data even if the leader doesn't participate
+savepoint settings;
+set local max_parallel_workers_per_gather = 2;
+set local work_mem = '4MB';
+set local parallel_leader_participation = off;
+select * from hash_join_batches(
+$$
+ select count(*) from simple r join simple s using (id);
+$$);
+rollback to settings;
+
-- A full outer join where every record is matched.
-- non-parallel
--
2.15.0
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: pgsql: Add some regression tests that exercise hash join code.
2017-11-30 00:16 pgsql: Add some regression tests that exercise hash join code. Andres Freund <andres@anarazel.de>
2017-11-30 03:13 ` Re: pgsql: Add some regression tests that exercise hash join code. Tom Lane <tgl@sss.pgh.pa.us>
2017-11-30 03:47 ` Re: pgsql: Add some regression tests that exercise hash join code. Thomas Munro <thomas.munro@enterprisedb.com>
2017-11-30 10:53 ` Re: pgsql: Add some regression tests that exercise hash join code. Thomas Munro <thomas.munro@enterprisedb.com>
2017-11-30 16:06 ` Re: pgsql: Add some regression tests that exercise hash join code. Andres Freund <andres@anarazel.de>
2017-12-03 18:39 ` Re: pgsql: Add some regression tests that exercise hash join code. Andres Freund <andres@anarazel.de>
2017-12-03 20:12 ` Re: pgsql: Add some regression tests that exercise hash join code. Thomas Munro <thomas.munro@enterprisedb.com>
2017-12-03 23:18 ` Re: pgsql: Add some regression tests that exercise hash join code. Thomas Munro <thomas.munro@enterprisedb.com>
2017-12-03 23:28 ` Re: pgsql: Add some regression tests that exercise hash join code. Thomas Munro <thomas.munro@enterprisedb.com>
2017-12-04 20:21 ` Re: pgsql: Add some regression tests that exercise hash join code. Andres Freund <andres@anarazel.de>
2017-12-04 23:59 ` Re: pgsql: Add some regression tests that exercise hash join code. Thomas Munro <thomas.munro@enterprisedb.com>
@ 2017-12-05 19:03 ` Andres Freund <andres@anarazel.de>
2017-12-05 20:05 ` Re: pgsql: Add some regression tests that exercise hash join code. Thomas Munro <thomas.munro@enterprisedb.com>
0 siblings, 1 reply; 13+ messages in thread
From: Andres Freund @ 2017-12-05 19:03 UTC (permalink / raw)
To: Thomas Munro <thomas.munro@enterprisedb.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; pgsql-committers
Hi,
On 2017-12-05 12:59:21 +1300, Thomas Munro wrote:
> src/backend/commands/explain.c | 58 ++++++++++++++------
This didn't actually include nodeHash.h, therefore
ExecHashGetInstrumentation() didn't have a prototype. I added the
relevant include and remove the hashjoin.h include which isn't required
anymore.
Pushed, thanks for the patch. Let's see what the buildfarm says...
- Andres
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: pgsql: Add some regression tests that exercise hash join code.
2017-11-30 00:16 pgsql: Add some regression tests that exercise hash join code. Andres Freund <andres@anarazel.de>
2017-11-30 03:13 ` Re: pgsql: Add some regression tests that exercise hash join code. Tom Lane <tgl@sss.pgh.pa.us>
2017-11-30 03:47 ` Re: pgsql: Add some regression tests that exercise hash join code. Thomas Munro <thomas.munro@enterprisedb.com>
2017-11-30 10:53 ` Re: pgsql: Add some regression tests that exercise hash join code. Thomas Munro <thomas.munro@enterprisedb.com>
2017-11-30 16:06 ` Re: pgsql: Add some regression tests that exercise hash join code. Andres Freund <andres@anarazel.de>
2017-12-03 18:39 ` Re: pgsql: Add some regression tests that exercise hash join code. Andres Freund <andres@anarazel.de>
2017-12-03 20:12 ` Re: pgsql: Add some regression tests that exercise hash join code. Thomas Munro <thomas.munro@enterprisedb.com>
2017-12-03 23:18 ` Re: pgsql: Add some regression tests that exercise hash join code. Thomas Munro <thomas.munro@enterprisedb.com>
2017-12-03 23:28 ` Re: pgsql: Add some regression tests that exercise hash join code. Thomas Munro <thomas.munro@enterprisedb.com>
2017-12-04 20:21 ` Re: pgsql: Add some regression tests that exercise hash join code. Andres Freund <andres@anarazel.de>
2017-12-04 23:59 ` Re: pgsql: Add some regression tests that exercise hash join code. Thomas Munro <thomas.munro@enterprisedb.com>
2017-12-05 19:03 ` Re: pgsql: Add some regression tests that exercise hash join code. Andres Freund <andres@anarazel.de>
@ 2017-12-05 20:05 ` Thomas Munro <thomas.munro@enterprisedb.com>
0 siblings, 0 replies; 13+ messages in thread
From: Thomas Munro @ 2017-12-05 20:05 UTC (permalink / raw)
To: Andres Freund <andres@anarazel.de>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; pgsql-committers
On Wed, Dec 6, 2017 at 8:03 AM, Andres Freund <andres@anarazel.de> wrote:
> On 2017-12-05 12:59:21 +1300, Thomas Munro wrote:
>> src/backend/commands/explain.c | 58 ++++++++++++++------
>
> This didn't actually include nodeHash.h, ...
Ugh, I'd lost -Werror from my COPT. Back in there it goes.
> Pushed, thanks for the patch. Let's see what the buildfarm says...
Thank you. I'm keeping an eye on it.
By the way, the current coding of ExecSortRetrieveInstrumentation()
and now also ExecHashRetrieveInstrumentation() is wrong in the case of
rescans, since they get called multiple times but are written in a way
that assumes they'll be called only once:
https://www.postgresql.org/message-id/CAA4eK1JBj4YCEQKeTua5%3DBMXy7zW7zNOvoXomzBP%3Dkb_aqMF7w%40mail...
Amit's patch would move ExecParallelRetrieveInstrumentation() so that
they are called only once, so that would fix that problem without any
change to this code. More over on that thread.
--
Thomas Munro
http://www.enterprisedb.com
^ permalink raw reply [nested|flat] 13+ messages in thread
end of thread, other threads:[~2017-12-05 20:05 UTC | newest]
Thread overview: 13+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-11-30 00:16 pgsql: Add some regression tests that exercise hash join code. Andres Freund <andres@anarazel.de>
2017-11-30 03:13 ` Tom Lane <tgl@sss.pgh.pa.us>
2017-11-30 03:47 ` Thomas Munro <thomas.munro@enterprisedb.com>
2017-11-30 10:53 ` Thomas Munro <thomas.munro@enterprisedb.com>
2017-11-30 16:06 ` Andres Freund <andres@anarazel.de>
2017-12-03 18:39 ` Andres Freund <andres@anarazel.de>
2017-12-03 20:12 ` Thomas Munro <thomas.munro@enterprisedb.com>
2017-12-03 23:18 ` Thomas Munro <thomas.munro@enterprisedb.com>
2017-12-03 23:28 ` Thomas Munro <thomas.munro@enterprisedb.com>
2017-12-04 20:21 ` Andres Freund <andres@anarazel.de>
2017-12-04 23:59 ` Thomas Munro <thomas.munro@enterprisedb.com>
2017-12-05 19:03 ` Andres Freund <andres@anarazel.de>
2017-12-05 20:05 ` Thomas Munro <thomas.munro@enterprisedb.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox