EXPLAIN of Parallel Append

From: Jesper Pedersen <jesper(dot)pedersen(at)redhat(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Cc: amitdkhan(dot)pg(at)gmail(dot)com
Subject: EXPLAIN of Parallel Append
Date: 2018-03-14 15:28:29
Message-ID: f7b47ff9-ce7b-2e90-0082-f11fa4940079@redhat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

Given

-- test.sql --
CREATE TABLE t1 (

a integer NOT NULL,
b integer NOT NULL
) PARTITION BY HASH (b);
CREATE TABLE t1_p00 PARTITION OF t1 FOR VALUES WITH (MODULUS 4,
REMAINDER 0);
CREATE TABLE t1_p01 PARTITION OF t1 FOR VALUES WITH (MODULUS 4,
REMAINDER 1);
CREATE TABLE t1_p02 PARTITION OF t1 FOR VALUES WITH (MODULUS 4,
REMAINDER 2);
CREATE TABLE t1_p03 PARTITION OF t1 FOR VALUES WITH (MODULUS 4,
REMAINDER 3);
INSERT INTO t1 (SELECT i, i FROM generate_series(1, 1000000) AS i);
ANALYZE;
-- test.sql --

Running

EXPLAIN (ANALYZE) SELECT * FROM t1 WHERE a = 5432;

gives

Gather (cost=1000.00..12780.36 rows=4 width=8) (actual
time=61.270..61.309 rows=1 loops=1)
Workers Planned: 2
Workers Launched: 2
-> Parallel Append (cost=0.00..11779.96 rows=4 width=8) (actual
time=38.915..57.209 rows=0 loops=3)
-> Parallel Seq Scan on t1_p01 (cost=0.00..2949.00 rows=1
width=8) (actual time=38.904..38.904 rows=0 loops=1)
Filter: (a = 5432)
Rows Removed by Filter: 250376
-> Parallel Seq Scan on t1_p03 (cost=0.00..2948.07 rows=1
width=8) (actual time=0.369..47.909 rows=1 loops=1)
Filter: (a = 5432)
Rows Removed by Filter: 250248
-> Parallel Seq Scan on t1_p02 (cost=0.00..2942.66 rows=1
width=8) (actual time=11.354..11.354 rows=0 loops=3)
Filter: (a = 5432)
Rows Removed by Filter: 83262
-> Parallel Seq Scan on t1_p00 (cost=0.00..2940.21 rows=1
width=8) (actual time=50.745..50.745 rows=0 loops=1)
Filter: (a = 5432)
Rows Removed by Filter: 249589
Planning time: 0.381 ms
Execution time: 62.810 ms
(18 rows)

Parallel Append's ntuples is 1, but given nloops is 3 you end up with
the slightly confusing "(actual ... *rows=0* loops=3)".

Using master (3b7ab438).

Thoughts ?

Best regards,
Jesper

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2018-03-14 16:07:09 Re: ExplainProperty* and units
Previous Message Alvaro Herrera 2018-03-14 15:06:41 Re: Failed to request an autovacuum work-item in silence