explain.depesz.com

PostgreSQL's explain analyze made readable

Result: kh3J

Settings
# exclusive inclusive rows x rows loops node
1. 1.790 1,549.234 ↓ 2,637.0 2,637 1

GroupAggregate (cost=207,543.81..207,543.85 rows=1 width=87) (actual time=1,547.350..1,549.234 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.402 1,547.444 ↓ 2,637.0 2,637 1

Sort (cost=207,543.81..207,543.81 rows=1 width=43) (actual time=1,547.336..1,547.444 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. 49.341 1,544.042 ↓ 2,637.0 2,637 1

Nested Loop Left Join (cost=83,357.70..207,543.80 rows=1 width=43) (actual time=607.641..1,544.042 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. 0.000 819.629 ↓ 2,637.0 2,637 1

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

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

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

  • Workers Planned: 1
  • Workers Launched: 1
6. 51.909 868.487 ↓ 1,318.0 1,318 2 / 2

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

7. 12.873 687.619 ↓ 1,083.7 128,958 2 / 2

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

8. 6.356 6.356 ↑ 1.0 2 2 / 2

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

  • Filter: (channel_id = 259)
  • Rows Removed by Filter: 5,728
9. 668.390 668.390 ↓ 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=84.921..267.356 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. 5.274 5.274 ↑ 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.002 rows=1 loops=2,637)

  • Index Cond: (id = 4,169)
12. 102.973 675.072 ↑ 5.9 240 2,637

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

  • Group Key: stats_general_regular.date, stats_general_regular.app_id, stats_general_regular.country
13. 0.833 572.099 ↓ 1.1 13,457 1

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

14. 56.358 571.266 ↓ 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=519.560..571.266 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))
  • Heap Blocks: exact=8,022
15. 32.033 514.908 ↓ 0.0 0 1

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

16. 148.683 148.683 ↑ 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=148.683..148.683 rows=907,582 loops=1)

  • Index Cond: ((customer_id = 857) AND (date >= '2020-07-26'::date) AND (date <= '2020-07-27'::date))
17. 334.192 334.192 ↑ 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=334.192..334.192 rows=1,583,116 loops=1)

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