explain.depesz.com

PostgreSQL's explain analyze made readable

Result: mwMZ

Settings
# exclusive inclusive rows x rows loops node
1. 1.787 1,433.447 ↓ 2,637.0 2,637 1

GroupAggregate (cost=207,543.81..207,543.85 rows=1 width=87) (actual time=1,431.560..1,433.447 rows=2,637 loops=1)

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

Sort (cost=207,543.81..207,543.81 rows=1 width=43) (actual time=1,431.548..1,431.660 rows=2,637 loops=1)

  • Sort Key: stats_adrevenue.date, stats_adrevenue.country, stats_adrevenue.ad_unit_map_id, core_app.customer_id
  • Sort Method: quicksort Memory: 322kB
3. 47.265 1,428.255 ↓ 2,637.0 2,637 1

Nested Loop Left Join (cost=83,357.70..207,543.80 rows=1 width=43) (actual time=500.549..1,428.255 rows=2,637 loops=1)

  • Join Filter: ((core_app.id = stats_general_regular.app_id) AND (stats_adrevenue.date = stats_general_regular.date) AND ((stats_adrevenue.country)::text = (stats_general_regular.country)::text))
  • Rows Removed by Join Filter: 628,995
4. 1.519 806.124 ↓ 2,637.0 2,637 1

Nested Loop (cost=1,001.13..125,130.71 rows=1 width=43) (actual time=26.825..806.124 rows=2,637 loops=1)

5. 0.000 801.968 ↓ 2,637.0 2,637 1

Gather (cost=1,000.85..125,126.40 rows=1 width=35) (actual time=26.815..801.968 rows=2,637 loops=1)

  • Workers Planned: 1
  • Workers Launched: 1
6. 47.615 844.938 ↓ 1,318.0 1,318 2 / 2

Nested Loop (cost=0.85..124,126.30 rows=1 width=35) (actual time=457.544..844.938 rows=1,318 loops=2)

7. 12.109 668.364 ↓ 1,083.7 128,958 2 / 2

Nested Loop (cost=0.57..124,090.22 rows=119 width=35) (actual time=133.315..668.364 rows=128,958 loops=2)

8. 6.545 6.545 ↑ 1.0 2 2 / 2

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

  • Filter: (channel_id = 259)
  • Rows Removed by Filter: 5,728
9. 649.710 649.710 ↓ 2.3 51,583 5 / 2

Index Scan using stats_adrevenue_date_app_map_id_connecte_6b5281f1_uniq on stats_adrevenue (cost=0.57..60,627.68 rows=22,155 width=35) (actual time=74.679..259.884 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))
10. 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
11. 2.637 2.637 ↑ 1.0 1 2,637

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)
12. 104.131 574.866 ↑ 5.9 240 2,637

HashAggregate (cost=82,356.57..82,374.23 rows=1,413 width=14) (actual time=0.180..0.218 rows=240 loops=2,637)

  • Group Key: stats_general_regular.date, stats_general_regular.app_id, stats_general_regular.country
13. 0.719 470.735 ↓ 1.1 13,457 1

Append (cost=56,706.67..82,229.01 rows=12,756 width=18) (actual time=455.205..470.735 rows=13,457 loops=1)

14. 19.356 470.016 ↓ 1.1 13,457 1

Bitmap Heap Scan on stats_general_regular (cost=56,706.67..82,165.23 rows=12,756 width=18) (actual time=455.205..470.016 rows=13,457 loops=1)

  • Recheck Cond: ((customer_id = 857) AND (date >= '2020-07-26'::date) AND (date <= '2020-07-27'::date) AND (app_id = 4,169))
  • Filter: (NOT has_partition)
  • Heap Blocks: exact=8,022
15. 31.832 450.660 ↓ 0.0 0 1

BitmapAnd (cost=56,706.67..56,706.67 rows=12,756 width=0) (actual time=450.660..450.660 rows=0 loops=1)

16. 121.377 121.377 ↑ 1.2 907,582 1

Bitmap Index Scan on stats_general_regular_customer_date_idx (cost=0.00..23,861.43 rows=1,102,789 width=0) (actual time=121.377..121.377 rows=907,582 loops=1)

  • Index Cond: ((customer_id = 857) AND (date >= '2020-07-26'::date) AND (date <= '2020-07-27'::date))
17. 297.451 297.451 ↑ 1.1 1,583,116 1

Bitmap Index Scan on stats_general_regular_app_idx (cost=0.00..32,838.60 rows=1,675,738 width=0) (actual time=297.451..297.451 rows=1,583,116 loops=1)

  • Index Cond: (app_id = 4,169)
Planning time : 1.701 ms
Execution time : 1,437.278 ms