pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Justin Pryzby <pryzby@telsasoft.com>
To: pgsql-hackers@postgresql.org
Cc: David Rowley <dgrowleyml@gmail.com>
Cc: Jeff Davis <jdavis@postgresql.org>
Subject: pg13dev: explain partial, parallel hashagg, and memory use
Date: Tue, 4 Aug 2020 20:21:05 -0500
Message-ID: <20200805012105.GZ28072@telsasoft.com> (raw)

I'm testing with a customer's data on pg13dev and got output for which Peak
Memory doesn't look right/useful.  I reproduced it on 565f16902.

CREATE TABLE p(i int) PARTITION BY RANGE(i);
CREATE TABLE p1 PARTITION OF p FOR VALUES FROM (0)TO(1000);
CREATE TABLE p2 PARTITION OF p FOR VALUES FROM (1000)TO(2000);
CREATE TABLE p3 PARTITION OF p FOR VALUES FROM (2000)TO(3000);
INSERT INTO p SELECT i%3000 FROM generate_series(1,999999)i;
VACUUM ANALYZE p;

postgres=# explain(analyze,settings) SELECT i, COUNT(1) FROM p GROUP BY 1;
                                                              QUERY PLAN                                                               
---------------------------------------------------------------------------------------------------------------------------------------
 Gather  (cost=7469.00..14214.45 rows=2502 width=12) (actual time=489.409..514.209 rows=3000 loops=1)
   Workers Planned: 2
   Workers Launched: 2
   ->  Parallel Append  (cost=6469.00..12964.25 rows=1251 width=12) (actual time=476.291..477.179 rows=1000 loops=3)
         ->  HashAggregate  (cost=6487.99..6497.99 rows=1000 width=12) (actual time=474.454..475.203 rows=1000 loops=1)
               Group Key: p.i
               Batches: 1  Memory Usage: 0kB
               Worker 0:  Batches: 1  Memory Usage: 193kB
               Worker 1:  Batches: 1  Memory Usage: 0kB
               ->  Seq Scan on p1 p  (cost=0.00..4817.99 rows=333999 width=4) (actual time=0.084..100.677 rows=333999 loops=1)
         ->  HashAggregate  (cost=6469.00..6479.00 rows=1000 width=12) (actual time=468.517..469.272 rows=1000 loops=1)
               Group Key: p_1.i
               Batches: 1  Memory Usage: 0kB
               Worker 0:  Batches: 1  Memory Usage: 0kB
               Worker 1:  Batches: 1  Memory Usage: 193kB
               ->  Seq Scan on p2 p_1  (cost=0.00..4804.00 rows=333000 width=4) (actual time=0.082..102.154 rows=333000 loops=1)
         ->  HashAggregate  (cost=6469.00..6479.00 rows=1000 width=12) (actual time=485.887..486.509 rows=1000 loops=1)
               Group Key: p_2.i
               Batches: 1  Memory Usage: 193kB
               Worker 0:  Batches: 1  Memory Usage: 0kB
               Worker 1:  Batches: 1  Memory Usage: 0kB
               ->  Seq Scan on p3 p_2  (cost=0.00..4804.00 rows=333000 width=4) (actual time=0.043..104.631 rows=333000 loops=1)
 Settings: effective_io_concurrency = '0', enable_partitionwise_aggregate = 'on', enable_partitionwise_join = 'on', work_mem = '127MB'

-- 
Justin





view thread (8+ messages)  latest in thread

Message-ID: <20200805012105.GZ28072@telsasoft.com>
Permalink:  ../20200805012105.GZ28072@telsasoft.com/
Also on:    postgresql.org/message-id/20200805012105.GZ28072@telsasoft.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: pryzby@telsasoft.com, dgrowleyml@gmail.com, jdavis@postgresql.org
  Subject: Re: pg13dev: explain partial, parallel hashagg, and memory use
  In-Reply-To: <20200805012105.GZ28072@telsasoft.com>
  References: <20200805012105.GZ28072@telsasoft.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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