explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 5XiY

Settings
# exclusive inclusive rows x rows loops node
1. 2.622 5,167.565 ↓ 2,637.0 2,637 1

Finalize GroupAggregate (cost=195,832.25..195,832.45 rows=1 width=87) (actual time=5,162.500..5,167.565 rows=2,637 loops=1)

  • Group Key: stats_adrevenue.date, stats_adrevenue.country, core_adrevenue_app_map.app_id, core_app.customer_id, core_connectedchannel.channel_id, stats_adrevenue.ad_unit_map_id
2. 1,221.054 5,164.943 ↓ 2,637.0 2,637 1

Gather Merge (cost=195,832.25..195,832.41 rows=1 width=87) (actual time=5,162.487..5,164.943 rows=2,637 loops=1)

  • Workers Planned: 1
  • Workers Launched: 1
3. 1.011 3,943.889 ↓ 1,318.0 1,318 2 / 2

Partial GroupAggregate (cost=194,832.24..194,832.29 rows=1 width=87) (actual time=3,942.810..3,943.889 rows=1,318 loops=2)

  • Group Key: stats_adrevenue.date, stats_adrevenue.country, core_adrevenue_app_map.app_id, core_app.customer_id, core_connectedchannel.channel_id, stats_adrevenue.ad_unit_map_id
4. 1.411 3,942.878 ↓ 1,318.0 1,318 2 / 2

Sort (cost=194,832.24..194,832.25 rows=1 width=43) (actual time=3,942.802..3,942.878 rows=1,318 loops=2)

  • Sort Key: stats_adrevenue.date, stats_adrevenue.country, core_app.customer_id, stats_adrevenue.ad_unit_map_id
  • Sort Method: quicksort Memory: 322kB
  • Worker 0: Sort Method: quicksort Memory: 25kB
5. 0.476 3,941.467 ↓ 1,318.0 1,318 2 / 2

Merge Left Join (cost=194,675.06..194,832.23 rows=1 width=43) (actual time=3,939.333..3,941.467 rows=1,318 loops=2)

  • Merge Cond: ((stats_adrevenue.date = stats_general_regular.date) AND ((stats_adrevenue.country)::text = (stats_general_regular.country)::text))
  • Join Filter: (core_app.id = stats_general_regular.app_id)
6. 1.322 2,657.623 ↓ 1,318.0 1,318 2 / 2

Sort (cost=127,459.62..127,459.62 rows=1 width=43) (actual time=2,657.503..2,657.623 rows=1,318 loops=2)

  • Sort Key: stats_adrevenue.date, stats_adrevenue.country
  • Sort Method: quicksort Memory: 322kB
  • Worker 0: Sort Method: quicksort Memory: 25kB
7. 0.602 2,656.301 ↓ 1,318.0 1,318 2 / 2

Nested Loop (cost=1.13..127,459.61 rows=1 width=43) (actual time=1,425.818..2,656.301 rows=1,318 loops=2)

8. 54.542 2,654.381 ↓ 1,318.0 1,318 2 / 2

Nested Loop (cost=0.85..127,455.30 rows=1 width=35) (actual time=1,425.811..2,654.381 rows=1,318 loops=2)

9. 12.486 2,470.880 ↓ 1,057.0 128,958 2 / 2

Nested Loop (cost=0.57..127,418.31 rows=122 width=35) (actual time=1,037.898..2,470.880 rows=128,958 loops=2)

10. 10.419 10.419 ↑ 1.0 2 2 / 2

Parallel Seq Scan on core_connectedchannel (cost=0.00..2,391.76 rows=2 width=8) (actual time=2.186..10.419 rows=2 loops=2)

  • Filter: (channel_id = 259)
  • Rows Removed by Filter: 5,724
11. 2,447.975 2,447.975 ↓ 2.3 51,583 5 / 2

Index Scan using stats_adrevenue_date_app_map_id_connecte_6b5281f1_uniq on stats_adrevenue (cost=0.57..62,285.33 rows=22,795 width=35) (actual time=438.243..979.190 rows=51,583 loops=5)

  • Index Cond: ((date >= '2020-07-26'::date) AND (date <= '2020-07-27'::date) AND (connected_channel_id = core_connectedchannel.id))
12. 128.959 128.959 ↓ 0.0 0 257,917 / 2

Index Scan using core_adrevenue_app_map_pkey on core_adrevenue_app_map (cost=0.28..0.30 rows=1 width=8) (actual time=0.001..0.001 rows=0 loops=257,917)

  • Index Cond: (id = stats_adrevenue.app_map_id)
  • Filter: (app_id = 4,169)
  • Rows Removed by Filter: 1
13. 1.319 1.319 ↑ 1.0 1 2,637 / 2

Index Scan using core_app_pkey on core_app (cost=0.28..4.30 rows=1 width=8) (actual time=0.001..0.001 rows=1 loops=2,637)

  • Index Cond: (id = 4,169)
14. 0.036 1,283.368 ↑ 3.0 474 1 / 2

Materialize (cost=67,215.44..67,365.53 rows=1,413 width=14) (actual time=2,563.651..2,566.736 rows=474 loops=1)

15. 1.001 1,283.332 ↑ 3.0 474 1 / 2

GroupAggregate (cost=67,215.44..67,347.87 rows=1,413 width=14) (actual time=2,563.646..2,566.664 rows=474 loops=1)

  • Group Key: stats_general_regular.date, stats_general_regular.app_id, stats_general_regular.country
16. 5.609 1,282.331 ↓ 1.5 13,451 1 / 2

Sort (cost=67,215.44..67,238.40 rows=9,181 width=18) (actual time=2,563.631..2,564.662 rows=13,451 loops=1)

  • Sort Key: stats_general_regular.date, stats_general_regular.country
  • Sort Method: quicksort Memory: 1,435kB
17. 0.398 1,276.722 ↓ 1.5 13,451 1 / 2

Append (cost=48,207.22..66,611.13 rows=9,181 width=18) (actual time=2,503.405..2,553.443 rows=13,451 loops=1)

18. 33.527 1,276.324 ↓ 1.5 13,451 1 / 2

Bitmap Heap Scan on stats_general_regular (cost=48,207.22..66,565.23 rows=9,181 width=18) (actual time=2,503.403..2,552.648 rows=13,451 loops=1)

  • Recheck Cond: ((customer_id = 857) AND (date >= '2020-07-26'::date) AND (date <= '2020-07-27'::date) AND (app_id = 4,169))
  • Heap Blocks: exact=6,552
19. 24.700 1,242.797 ↓ 0.0 0 1 / 2

BitmapAnd (cost=48,207.22..48,207.22 rows=9,181 width=0) (actual time=2,485.594..2,485.594 rows=0 loops=1)

20. 579.661 579.661 ↓ 2.0 1,711,112 1 / 2

Bitmap Index Scan on stats_general_regular_customer_date_idx (cost=0.00..18,637.05 rows=868,838 width=0) (actual time=1,159.322..1,159.322 rows=1,711,112 loops=1)

  • Index Cond: ((customer_id = 857) AND (date >= '2020-07-26'::date) AND (date <= '2020-07-27'::date))
21. 638.436 638.436 ↓ 1.1 1,641,453 1 / 2

Bitmap Index Scan on stats_general_regular_app_idx (cost=0.00..29,565.34 rows=1,521,969 width=0) (actual time=1,276.872..1,276.872 rows=1,641,453 loops=1)

  • Index Cond: (app_id = 4,169)
Planning time : 3.833 ms
Execution time : 5,173.662 ms