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

Reply via email to