explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 8LyP

Settings
# exclusive inclusive rows x rows loops node
1. 50.189 9,765.356 ↑ 46.4 938 1

GroupAggregate (cost=2,940,974.41..2,945,330.51 rows=43,561 width=349) (actual time=9,709.304..9,765.356 rows=938 loops=1)

  • Group Key: weekly_promotions_summary.summary, weekly_promotions_summary.server, bb.platform_id, bb.brand_id, weekly_promotions_summary.promo_name, weekly_promotions_summary.optin_status, weekly_promotions_summary.week_no, bb.operator_group, bb.brand, bb.hub, bb.platform, (sum(weekly_promotions_summary.bets_euro)), (sum(weekly_promotions_summary.margin_euro)), (sum(weekly_promotions_summary.rev_euro)), (sum(weekly_promotions_summary.spins))
2. 240.036 9,715.167 ↑ 1.5 29,224 1

Sort (cost=2,940,974.41..2,941,083.31 rows=43,561 width=353) (actual time=9,709.164..9,715.167 rows=29,224 loops=1)

  • Sort Key: weekly_promotions_summary.server, bb.platform_id, bb.brand_id, weekly_promotions_summary.promo_name, weekly_promotions_summary.optin_status, weekly_promotions_summary.week_no, bb.operator_group, bb.brand, bb.hub, bb.platform, (sum(weekly_promotions_summary.bets_euro)), (sum(weekly_promotions_summary.margin_euro)), (sum(weekly_promotions_summary.rev_euro)), (sum(weekly_promotions_summary.spins))
  • Sort Method: external sort Disk: 8,024kB
3. 22.850 9,475.131 ↑ 1.5 29,224 1

Merge Left Join (cost=2,912,201.25..2,933,431.77 rows=43,561 width=353) (actual time=9,155.313..9,475.131 rows=29,224 loops=1)

  • Merge Cond: (((weekly_promotions_summary.server)::text = (bb.server)::text) AND (weekly_promotions_summary.platform_id = ((bb.platform_id)::numeric)) AND (weekly_promotions_summary.brand_id = ((bb.brand_id)::numeric)))
4. 61.065 9,382.101 ↑ 1.5 29,224 1

Merge Left Join (cost=2,909,712.52..2,930,113.28 rows=43,561 width=316) (actual time=9,088.713..9,382.101 rows=29,224 loops=1)

  • Merge Cond: (((weekly_promotions_summary.server)::text = (b.server)::text) AND (weekly_promotions_summary.platform_id = b.platform_id) AND (weekly_promotions_summary.brand_id = b.brand_id) AND ((weekly_promotions_summary.promo_name)::text = (b.promo_name)::text) AND ((weekly_promotions_summary.optin_status)::text = (b.optin_status)::text))
5. 20.417 1,563.590 ↑ 46.4 938 1

GroupAggregate (cost=536,250.90..538,455.74 rows=43,561 width=184) (actual time=1,539.979..1,563.590 rows=938 loops=1)

  • Group Key: weekly_promotions_summary.summary, weekly_promotions_summary.server, weekly_promotions_summary.platform_id, weekly_promotions_summary.brand_id, weekly_promotions_summary.promo_name, weekly_promotions_summary.optin_status, weekly_promotions_summary.week_no
6. 75.659 1,543.173 ↑ 1.8 24,547 1

Sort (cost=536,250.90..536,362.04 rows=44,454 width=132) (actual time=1,539.945..1,543.173 rows=24,547 loops=1)

  • Sort Key: weekly_promotions_summary.server, weekly_promotions_summary.platform_id, weekly_promotions_summary.brand_id, weekly_promotions_summary.promo_name, weekly_promotions_summary.optin_status, weekly_promotions_summary.week_no
  • Sort Method: quicksort Memory: 7,027kB
7. 1,467.514 1,467.514 ↑ 1.8 24,547 1

Index Scan using weekly_promotions_summary_pk on weekly_promotions_summary (cost=0.56..532,819.05 rows=44,454 width=132) (actual time=294.157..1,467.514 rows=24,547 loops=1)

  • Index Cond: (summary = '2020-08-04'::date)
8. 16.382 7,757.446 ↑ 5.7 171,352 1

Materialize (cost=2,373,461.62..2,378,380.41 rows=983,759 width=179) (actual time=7,548.431..7,757.446 rows=171,352 loops=1)

9. 826.186 7,741.064 ↑ 5.7 171,352 1

Sort (cost=2,373,461.62..2,375,921.02 rows=983,759 width=179) (actual time=7,548.423..7,741.064 rows=171,352 loops=1)

  • Sort Key: b.server, b.platform_id, b.brand_id, b.promo_name, b.optin_status
  • Sort Method: external merge Disk: 23,616kB
10. 22.169 6,914.878 ↑ 5.7 171,352 1

Subquery Scan on b (cost=1,051,901.64..2,224,331.57 rows=983,759 width=179) (actual time=3,080.476..6,914.878 rows=171,352 loops=1)

11. 1,543.446 6,892.709 ↑ 5.7 171,352 1

Finalize GroupAggregate (cost=1,051,901.64..2,214,493.98 rows=983,759 width=179) (actual time=3,080.472..6,892.709 rows=171,352 loops=1)

  • Group Key: weekly_promotions_summary_1.summary, weekly_promotions_summary_1.brand_id, weekly_promotions_summary_1.platform_id, weekly_promotions_summary_1.server, weekly_promotions_summary_1.optin_status, weekly_promotions_summary_1.promo_name
12. 636.098 5,349.263 ↑ 12.2 566,708 1

Gather Merge (cost=1,051,901.64..1,953,797.84 rows=6,886,313 width=179) (actual time=3,080.439..5,349.263 rows=566,708 loops=1)

  • Workers Planned: 7
  • Workers Launched: 7
13. 1,428.159 4,713.165 ↑ 13.9 70,838 8 / 8

Partial GroupAggregate (cost=1,050,901.52..1,109,224.38 rows=983,759 width=179) (actual time=3,015.309..4,713.165 rows=70,838 loops=8)

  • Group Key: weekly_promotions_summary_1.summary, weekly_promotions_summary_1.brand_id, weekly_promotions_summary_1.platform_id, weekly_promotions_summary_1.server, weekly_promotions_summary_1.optin_status, weekly_promotions_summary_1.promo_name
14. 2,136.299 3,285.006 ↑ 1.1 1,229,084 8 / 8

Sort (cost=1,050,901.52..1,054,414.95 rows=1,405,370 width=127) (actual time=3,015.266..3,285.006 rows=1,229,084 loops=8)

  • Sort Key: weekly_promotions_summary_1.summary, weekly_promotions_summary_1.brand_id, weekly_promotions_summary_1.platform_id, weekly_promotions_summary_1.server, weekly_promotions_summary_1.optin_status, weekly_promotions_summary_1.promo_name
  • Sort Method: external merge Disk: 194,680kB
15. 1,148.707 1,148.707 ↑ 1.1 1,229,084 8 / 8

Parallel Seq Scan on weekly_promotions_summary weekly_promotions_summary_1 (cost=0.00..853,937.70 rows=1,405,370 width=127) (actual time=0.029..1,148.707 rows=1,229,084 loops=8)

16. 60.966 70.180 ↓ 2.5 47,130 1

Sort (cost=2,488.73..2,536.10 rows=18,948 width=54) (actual time=66.582..70.180 rows=47,130 loops=1)

  • Sort Key: bb.server, ((bb.platform_id)::numeric), ((bb.brand_id)::numeric)
  • Sort Method: quicksort Memory: 3,407kB
17. 9.214 9.214 ↑ 1.0 18,948 1

Seq Scan on brand_info bb (cost=0.00..1,142.50 rows=18,948 width=54) (actual time=0.026..9.214 rows=18,948 loops=1)

  • Filter: ((product)::text = 'SLOTS'::text)
  • Rows Removed by Filter: 692
Planning time : 1.192 ms
Execution time : 9,797.724 ms