Closed
Description
Hello,
Great extension - but I've hit an issue, it doesn't seem to like GROUP BY when combined with parallel query.
[iq=# set max_parallel_workers_per_gather =0;
SET
Time: 0.521 ms
iq=# explain SELECT mac_address, count(*)
FROM read_delta mr
WHERE
time_key between (timestamp'2016-09-10 00:00:00' - interval '2' day) and timestamp'2016-09-10 00:00:00'
group by mac_address
;
QUERY PLAN
-----------------------------------------------------------------------------------------------------
HashAggregate (cost=17885378.13..17886574.05 rows=119592 width=25)
Group Key: mr.mac_address
-> Append (cost=0.00..15734665.80 rows=430142467 width=17)
-> Seq Scan on meter_read_delta_pm_8 mr (cost=0.00..5318375.71 rows=187703371 width=17)
-> Seq Scan on meter_read_delta_pm_9 mr_1 (cost=0.00..5291419.55 rows=186739455 width=17)
-> Seq Scan on meter_read_delta_pm_10 mr_2 (cost=0.00..5124870.54 rows=55699641 width=17)
Filter: (time_key <= '2016-09-10 00:00:00'::timestamp without time zone)
(7 rows)
Time: 6.563 ms
iq=# set max_parallel_workers_per_gather =16;
SET
Time: 0.438 ms
iq=# explain SELECT mac_address, count(*)
FROM read_delta mr
WHERE
time_key between (timestamp'2016-09-10 00:00:00' - interval '2' day) and timestamp'2016-09-10 00:00:00'
group by mac_address;
QUERY PLAN
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Finalize GroupAggregate (cost=1141.07..2337.11 rows=119592 width=25)
Group Key: mr.mac_address
-> Sort (cost=1141.07..1141.11 rows=16 width=25)
Sort Key: mr.mac_address
-> Gather (cost=1139.13..1140.75 rows=16 width=25)
Workers Planned: 16
-> Partial GroupAggregate (cost=139.13..139.15 rows=1 width=25)
Group Key: mr.mac_address
-> Sort (cost=139.13..139.14 rows=1 width=17)
Sort Key: mr.mac_address
-> Parallel Seq Scan on read_delta mr (cost=0.00..139.12 rows=1 width=17)
Filter: ((time_key >= '2016-09-08 00:00:00'::timestamp without time zone) AND (time_key <= '2016-09-10 00:00:00'::timestamp without time zone))
(12 rows)
iq=# explain SELECT mac_address
FROM read_delta mr
WHERE
time_key between (timestamp'2016-09-10 00:00:00' - interval '2' day) and timestamp'2016-09-10 00:00:00';
QUERY PLAN
-----------------------------------------------------------------------------------------------
Append (cost=0.00..15734665.80 rows=430142467 width=17)
-> Seq Scan on read_delta mr (cost=0.00..5318375.71 rows=187703371 width=17)
-> Seq Scan on read_delta_pm_9 mr_1 (cost=0.00..5291419.55 rows=186739455 width=17)
-> Seq Scan on read_delta_pm_10 mr_2 (cost=0.00..5124870.54 rows=55699641 width=17)
Filter: (time_key <= '2016-09-10 00:00:00'::timestamp without time zone)
(5 rows)