explain.depesz.com

PostgreSQL's explain analyze made readable

Result: hioWN

Settings
# exclusive inclusive rows x rows loops node
1. 1.714 3,758.056 ↓ 2,637.0 2,637 1

GroupAggregate (cost=196,606.69..196,606.73 rows=1 width=87) (actual time=3,756.251..3,758.056 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. 3.692 3,756.342 ↓ 2,637.0 2,637 1

Sort (cost=196,606.69..196,606.69 rows=1 width=43) (actual time=3,756.236..3,756.342 rows=2,637 loops=1)

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

Nested Loop Left Join (cost=72,544.58..196,606.68 rows=1 width=43) (actual time=2,936.564..3,752.650 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,996
4. 1.922 1,485.227 ↓ 2,637.0 2,637 1

Nested Loop (cost=1,001.13..125,006.71 rows=1 width=43) (actual time=818.481..1,485.227 rows=2,637 loops=1)

5. 673.880 1,480.668 ↓ 2,637.0 2,637 1

Gather (cost=1,000.85..125,002.40 rows=1 width=35) (actual time=818.461..1,480.668 rows=2,637 loops=1)

  • Workers Planned: 1
  • Workers Launched: 1
6. 45.175 806.788 ↓ 1,318.0 1,318 2 / 2

Nested Loop (cost=0.85..124,002.30 rows=1 width=35) (actual time=422.954..806.788 rows=1,318 loops=2)

7. 12.516 632.654 ↓ 1,083.7 128,958 2 / 2

Nested Loop (cost=0.57..123,966.22 rows=119 width=35) (actual time=132.487..632.654 rows=128,958 loops=2)

8. 8.656 8.656 ↑ 1.0 2 2 / 2

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

  • Filter: (channel_id = 259)
  • Rows Removed by Filter: 5,724
9. 611.482 611.482 ↓ 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,565.68 rows=22,155 width=35) (actual time=70.567..244.593 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. 100.419 2,215.080 ↑ 5.9 240 2,637

HashAggregate (cost=71,543.45..71,561.11 rows=1,413 width=14) (actual time=0.803..0.840 rows=240 loops=2,637)

  • Group Key: stats_general_regular.date, stats_general_regular.app_id, stats_general_regular.country
13. 0.771 2,114.661 ↓ 1.3 13,455 1

Append (cost=50,666.34..71,439.75 rows=10,370 width=18) (actual time=2,071.157..2,114.661 rows=13,455 loops=1)

14. 59.213 2,113.890 ↓ 1.3 13,455 1

Bitmap Heap Scan on stats_general_regular (cost=50,666.34..71,387.90 rows=10,370 width=18) (actual time=2,071.155..2,113.890 rows=13,455 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=7,518
15. 52.330 2,054.677 ↓ 0.0 0 1

BitmapAnd (cost=50,666.34..50,666.34 rows=10,370 width=0) (actual time=2,054.677..2,054.677 rows=0 loops=1)

16. 905.038 905.038 ↓ 2.1 2,163,243 1

Bitmap Index Scan on stats_general_regular_customer_date_idx (cost=0.00..21,924.43 rows=1,016,629 width=0) (actual time=905.037..905.038 rows=2,163,243 loops=1)

  • Index Cond: ((customer_id = 857) AND (date >= '2020-07-26'::date) AND (date <= '2020-07-27'::date))
17. 1,097.309 1,097.309 ↓ 1.1 1,661,365 1

Bitmap Index Scan on stats_general_regular_app_idx (cost=0.00..28,736.47 rows=1,470,654 width=0) (actual time=1,097.309..1,097.309 rows=1,661,365 loops=1)

  • Index Cond: (app_id = 4,169)
Planning time : 4.180 ms
Execution time : 3,764.045 ms