Aggregate (cost=44189.87..44189.88 rows=1 width=64) (actual time=40.444..40.444 rows=1 loops=1) -> Finalize GroupAggregate (cost=44177.70..44188.59 rows=85 width=48) (actual time=39.773..40.433 rows=58 loops=1) Group Key: "*SELECT* 1".campaign_id -> Gather Merge (cost=44177.70..44186.83 rows=70 width=48) (actual time=39.713..43.177 rows=58 loops=1) Workers Planned: 2 Workers Launched: 2 -> Partial GroupAggregate (cost=43177.67..43178.72 rows=35 width=48) (actual time=30.665..31.042 rows=19 loops=3) Group Key: "*SELECT* 1".campaign_id -> Sort (cost=43177.67..43177.76 rows=35 width=22) (actual time=30.608..30.635 rows=472 loops=3) Sort Key: "*SELECT* 1".campaign_id Sort Method: quicksort Memory: 56kB Worker 0: Sort Method: quicksort Memory: 50kB Worker 1: Sort Method: quicksort Memory: 78kB -> Parallel Hash Join (cost=37975.22..43176.77 rows=35 width=22) (actual time=11.918..30.491 rows=472 loops=3) Hash Cond: (c.id = "*SELECT* 1".campaign_group_id) -> Parallel Seq Scan on fb_campaigns c (cost=0.00..4891.13 rows=82713 width=10) (actual time=0.008..12.089 rows=66171 loops=3) -> Parallel Hash (cost=37974.47..37974.47 rows=60 width=28) (actual time=10.362..10.363 rows=472 loops=3) Buckets: 1024 Batches: 1 Memory Usage: 136kB -> Parallel Append (cost=0.14..37974.47 rows=60 width=28) (actual time=2.041..9.178 rows=472 loops=3) -> Subquery Scan on "*SELECT* 1" (cost=0.14..8.18 rows=1 width=28) (actual time=0.004..0.004 rows=0 loops=1) -> Index Scan using fb_ad_activity_daily2_pkey on fb_ad_activity_daily (cost=0.14..8.17 rows=1 width=1618) (actual time=0.004..0.004 rows=0 loops=1) Index Cond: ((logdate >= '2019-11-01'::date) AND (logdate <= '2019-11-05'::date) AND (logdate >= '2019-11-01'::date) AND (logdate <= '2019-11-05'::date)) Filter: ((account_id = ANY ('{128091690677840,205971526867688,183647115790295}'::bigint[])) AND (account_id = ANY ('{128091690677840,205971526867688,183647115790295}'::bigint[]))) -> Subquery Scan on "*SELECT* 2" (cost=0.56..37965.98 rows=84 width=28) (actual time=2.039..9.139 rows=472 loops=3) -> Parallel Append (cost=0.56..37965.14 rows=49 width=1618) (actual time=2.039..9.082 rows=472 loops=3) -> Parallel Index Scan using fb_ad_activity_daily_archive_2019_pkey on fb_ad_activity_daily_archive_2019 (cost=0.56..37964.90 rows=49 width=1618) (actual time=2.039..9.043 rows=472 loops=3) Index Cond: ((logdate >= '2019-11-01'::date) AND (logdate <= '2019-11-05'::date) AND (logdate >= '2019-11-01'::date) AND (logdate <= '2019-11-05'::date) AND (account_id = ANY ('{128091690677840,205971526867688,183647115790295}'::bigint[])) AND (account_id = ANY ('{128091690677840,205971526867688,18 3647115790295}'::bigint[]))) Planning Time: 2.562 ms Execution Time: 43.444 ms (29 rows)