explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 3p83

Settings
# exclusive inclusive rows x rows loops node
1. 14.137 8,745.826 ↑ 1.3 2,663 1

HashAggregate (cost=12,667.53..12,353,976.54 rows=3,505 width=117) (actual time=70.774..8,745.826 rows=2,663 loops=1)

  • Group Key: agg.customer_id, agg.tenant
  • Execution Time: 8,746.851 ms(25 Zeilen)
2. 4.168 66.287 ↑ 1.3 2,663 1

Gather (cost=1,000.00..12,641.08 rows=3,526 width=53) (actual time=0.234..66.287 rows=2,663 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
3. 62.119 62.119 ↑ 1.7 888 3 / 3

Parallel Seq Scan on aggregated_orders agg (cost=0.00..11,288.48 rows=1,469 width=53) (actual time=0.032..62.119 rows=888 loops=3)

  • Filter: ((month >= '2019-06-14 00:00:00'::timestamp without time zone) AND (month < '2019-12-01 00:00:00'::timestamp without time zone) AND ((product_type)::text = 'MYO'::text))
  • Rows Removed by Filter: 190,723
4.          

SubPlan (for HashAggregate)

5. 5.326 37.282 ↓ 0.0 0 2,663

GroupAggregate (cost=0.55..8.59 rows=1 width=73) (actual time=0.014..0.014 rows=0 loops=2,663)

  • Group Key: aggregated_orders.customer_id
6. 31.956 31.956 ↓ 0.0 0 2,663

Index Scan using uq_aggregated_orders on aggregated_orders (cost=0.55..8.57 rows=1 width=49) (actual time=0.012..0.012 rows=0 loops=2,663)

  • Index Cond: (((customer_id)::text = (agg.customer_id)::text) AND ((product_type)::text = 'MYO'::text) AND (month = '2019-04-01 00:00:00'::timestamp without time zone))
7. 37.282 8,628.120 ↑ 1.0 1 2,663

GroupAggregate (cost=80.57..3,512.46 rows=1 width=49) (actual time=3.240..3.240 rows=1 loops=2,663)

  • Group Key: orders.customer_id
8. 7,475.041 8,590.838 ↑ 1.0 1 2,663

Bitmap Heap Scan on orders (cost=80.57..3,512.44 rows=1 width=41) (actual time=2.055..3.226 rows=1 loops=2,663)

  • Recheck Cond: ((ordered_ts >= '2019-06-14 00:00:00'::timestamp without time zone) AND (ordered_ts < '2019-12-01 00:00:00'::timestamp without time zone))
  • Filter: ((customer_id)::text = (agg.customer_id)::text)
  • Rows Removed by Filter: 3,073
  • Heap Blocks: exact=5,368,608
9. 1,115.797 1,115.797 ↑ 1.0 3,075 2,663

Bitmap Index Scan on idx_orders_ordered_ts (cost=0.00..80.57 rows=3,215 width=0) (actual time=0.419..0.419 rows=3,075 loops=2,663)

  • Index Cond: ((ordered_ts >= '2019-06-14 00:00:00'::timestamp without time zone) AND (ordered_ts < '2019-12-01 00:00:00'::timestamp without time zone))
Planning time : 0.252 ms