Nested Loop (cost=3922897668.03..3923087998.19 rows=1886 width=8) -> HashAggregate (cost=3922897582.53..3922898627.03 rows=2089 width=8) Group Key: items.account_id -> Gather (cost=1627484538.01..3878204404.03 rows=89386357 width=8) Workers Planned: 6 -> Parallel Hash Join (cost=1627483538.01..3869264768.33 rows=14897726 width=8) Hash Cond: (group_details.group_number = items.system_id) -> Nested Loop (cost=169.50..2229024487.68 rows=14897726 width=8) -> Parallel Append (cost=28.00..50522308.69 rows=14900704 width=24) -> Parallel Bitmap Heap Scan on item_interactions_p2019_10 (cost=3036876.93..37982793.93 rows=8060753 width=24) Recheck Cond: (published IS FALSE) Filter: (created_at >= '2019-10-06 00:00:00'::timestamp without time zone) -> Bitmap Index Scan on item_interactions_p2019_10_published_idx (cost=0.00..618651.08 rows=57181479 width=0) -> Parallel Index Scan using item_interactions_p2019_11_published_idx on item_interactions_p2019_11 (cost=113.00..8813972.26 rows=6839936 width=24) Filter: (created_at >= '2019-10-06 00:00:00'::timestamp without time zone) -> Parallel Bitmap Heap Scan on item_interactions_p2019_12 (cost=28.00..73.30 rows=12 width=32) Recheck Cond: (published IS FALSE) Filter: (created_at >= '2019-10-06 00:00:00'::timestamp without time zone) -> Bitmap Index Scan on item_interactions_p2019_12_published_idx (cost=0.00..27.00 rows=60 width=0) -> Parallel Bitmap Heap Scan on item_interactions_p2020_01 (cost=28.00..73.30 rows=12 width=32) Recheck Cond: (published IS FALSE) Filter: (created_at >= '2019-10-06 00:00:00'::timestamp without time zone) -> Bitmap Index Scan on item_interactions_p2020_01_published_idx (cost=0.00..27.00 rows=60 width=0) -> Parallel Bitmap Heap Scan on item_interactions_p2020_02 (cost=28.00..73.30 rows=12 width=32) Recheck Cond: (published IS FALSE) Filter: (created_at >= '2019-10-06 00:00:00'::timestamp without time zone) -> Bitmap Index Scan on item_interactions_p2020_02_published_idx (cost=0.00..27.00 rows=60 width=0) -> Parallel Bitmap Heap Scan on item_interactions_p2020_03 (cost=28.00..73.30 rows=12 width=32) Recheck Cond: (published IS FALSE) Filter: (created_at >= '2019-10-06 00:00:00'::timestamp without time zone) -> Bitmap Index Scan on item_interactions_p2020_03_published_idx (cost=0.00..27.00 rows=60 width=0) -> Parallel Bitmap Heap Scan on item_interactions_default (cost=28.00..73.30 rows=12 width=32) Recheck Cond: (published IS FALSE) Filter: (created_at >= '2019-10-06 00:00:00'::timestamp without time zone) -> Bitmap Index Scan on item_interactions_default_published_idx (cost=0.00..27.00 rows=60 width=0) -> Index Scan using index_item_tracking_details_on_reference_number on item_tracking_details group_details (cost=141.50..145.70 rows=1 width=31) Index Cond: ((reference_number)::text = (item_interactions_p2019_10.reference_id)::text) Filter: (rejected IS FALSE) -> Parallel Hash (cost=635688871.50..635688871.50 rows=986975281 width=16) -> Parallel Seq Scan on items (cost=0.00..635688871.50 rows=986975281 width=16) -> Index Scan using accounts_pkey on accounts (cost=85.50..90.66 rows=1 width=8) Index Cond: (id = items.account_id) Filter: (account_type = 'type_1'::account_type_enum)