explain.depesz.com

PostgreSQL's explain analyze made readable

Result: zGW0

Settings
# exclusive inclusive rows x rows loops node
1. 1.778 1,469.324 ↓ 2,637.0 2,637 1

GroupAggregate (cost=207,581.24..207,581.29 rows=1 width=87) (actual time=1,467.451..1,469.324 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.437 1,467.546 ↓ 2,637.0 2,637 1

Sort (cost=207,581.24..207,581.25 rows=1 width=43) (actual time=1,467.438..1,467.546 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. 48.498 1,464.109 ↓ 2,637.0 2,637 1

Nested Loop Left Join (cost=83,395.14..207,581.23 rows=1 width=43) (actual time=508.934..1,464.109 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 830.197 ↓ 2,637.0 2,637 1

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

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

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

  • Workers Planned: 1
  • Workers Launched: 1
6. 56.807 851.908 ↓ 1,318.0 1,318 2 / 2

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

7. 12.127 666.142 ↓ 1,083.7 128,958 2 / 2

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

8. 2.440 2.440 ↑ 1.0 2 2 / 2

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

  • Filter: (channel_id = 259)
  • Rows Removed by Filter: 5,728
9. 651.575 651.575 ↓ 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=75.181..260.630 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.002..0.002 rows=1 loops=2,637)

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

HashAggregate (cost=82,394.01..82,411.67 rows=1,413 width=14) (actual time=0.184..0.222 rows=240 loops=2,637)

  • Group Key: stats_general_regular.date, stats_general_regular.app_id, stats_general_regular.country
13. 0.734 481.940 ↓ 1.1 13,457 1

Append (cost=56,726.11..82,266.36 rows=12,765 width=18) (actual time=466.363..481.940 rows=13,457 loops=1)

14. 19.377 481.206 ↓ 1.1 13,457 1

Bitmap Heap Scan on stats_general_regular (cost=56,726.11..82,202.53 rows=12,765 width=18) (actual time=466.361..481.206 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. 31.839 461.829 ↓ 0.0 0 1

BitmapAnd (cost=56,726.11..56,726.11 rows=12,765 width=0) (actual time=461.829..461.829 rows=0 loops=1)

16. 124.004 124.004 ↑ 1.2 907,582 1

Bitmap Index Scan on stats_general_regular_customer_date_idx (cost=0.00..23,871.60 rows=1,103,602 width=0) (actual time=124.004..124.004 rows=907,582 loops=1)

  • Index Cond: ((customer_id = 857) AND (date >= '2020-07-26'::date) AND (date <= '2020-07-27'::date))
17. 305.986 305.986 ↑ 1.0 1,637,998 1

Bitmap Index Scan on stats_general_regular_app_idx (cost=0.00..32,847.88 rows=1,676,975 width=0) (actual time=305.986..305.986 rows=1,637,998 loops=1)

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