explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 1WEL

Settings
# exclusive inclusive rows x rows loops node
1. 0.006 6.201 ↓ 0.0 0 1

Subquery Scan on phone_tmp_roaming (cost=26.36..26.68 rows=1 width=1,350) (actual time=6.201..6.201 rows=0 loops=1)

  • Filter: ('[2018-03-01,2018-04-01)'::daterange @> phone_tmp_roaming.filter_date)
  • Rows Removed by Filter: 5
2. 0.125 6.195 ↓ 5.0 5 1

WindowAgg (cost=26.36..26.67 rows=1 width=1,354) (actual time=6.140..6.195 rows=5 loops=1)

3. 0.073 6.070 ↓ 5.0 5 1

Sort (cost=26.36..26.37 rows=1 width=1,310) (actual time=6.068..6.070 rows=5 loops=1)

  • Sort Key: phone_calls.carrier_account_id, (period_start(phone_calls.filter_date, carrier_accounts.contract_start_date))
  • Sort Method: quicksort Memory: 26kB
4. 0.908 5.997 ↓ 5.0 5 1

Nested Loop Left Join (cost=5.46..26.35 rows=1 width=1,310) (actual time=4.463..5.997 rows=5 loops=1)

  • Join Filter: ((roaming_days.carrier_account_id = phone_calls.carrier_account_id) AND (roaming_days.country_id = roaming_tariffs.country_id) AND (roaming_days.filter_date = phone_calls.filter_date))
  • Rows Removed by Join Filter: 23
5. 0.047 4.919 ↓ 5.0 5 1

Nested Loop (cost=4.04..24.48 rows=1 width=1,234) (actual time=4.184..4.919 rows=5 loops=1)

6. 0.199 4.822 ↓ 5.0 5 1

Nested Loop (cost=3.76..20.18 rows=1 width=1,234) (actual time=4.158..4.822 rows=5 loops=1)

  • Join Filter: (tariffs.country_id = pc_mncs.country_id)
  • Rows Removed by Join Filter: 5
7. 0.114 4.483 ↓ 10.0 10 1

Nested Loop (cost=3.48..11.87 rows=1 width=1,238) (actual time=4.018..4.483 rows=10 loops=1)

8. 3.758 4.109 ↓ 5.0 10 1

Hash Join (cost=3.34..5.64 rows=2 width=1,245) (actual time=3.997..4.109 rows=10 loops=1)

  • Hash Cond: (carrier_accounts.plan_id = tariffs.plan_id)
9. 0.118 0.223 ↑ 1.0 5 1

Hash Join (cost=1.11..3.37 rows=5 width=1,229) (actual time=0.162..0.223 rows=5 loops=1)

  • Hash Cond: (carrier_accounts.id = phone_calls.carrier_account_id)
10. 0.033 0.033 ↑ 1.0 15 1

Seq Scan on carrier_accounts (cost=0.00..2.15 rows=15 width=12) (actual time=0.024..0.033 rows=15 loops=1)

11. 0.031 0.072 ↑ 1.0 5 1

Hash (cost=1.05..1.05 rows=5 width=1,221) (actual time=0.072..0.072 rows=5 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
12. 0.041 0.041 ↑ 1.0 5 1

Seq Scan on phone_calls (cost=0.00..1.05 rows=5 width=1,221) (actual time=0.036..0.041 rows=5 loops=1)

13. 0.006 0.128 ↓ 2.0 4 1

Hash (cost=2.21..2.21 rows=2 width=16) (actual time=0.128..0.128 rows=4 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
14. 0.062 0.122 ↓ 2.0 4 1

Hash Join (cost=1.09..2.21 rows=2 width=16) (actual time=0.116..0.122 rows=4 loops=1)

  • Hash Cond: (tariffs.plan_id = roaming_tariffs.plan_id)
  • Join Filter: CASE WHEN (tariffs.roaming_rule_id IS NULL) THEN (roaming_tariffs.id = tariffs.id) ELSE (roaming_tariffs.roaming_rule_id = tariffs.roaming_rule_id) END
  • Rows Removed by Join Filter: 4
15. 0.030 0.030 ↑ 1.0 4 1

Seq Scan on tariffs (cost=0.00..1.04 rows=4 width=16) (actual time=0.029..0.030 rows=4 loops=1)

16. 0.010 0.030 ↑ 1.0 4 1

Hash (cost=1.04..1.04 rows=4 width=16) (actual time=0.030..0.030 rows=4 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
17. 0.020 0.020 ↑ 1.0 4 1

Seq Scan on tariffs roaming_tariffs (cost=0.00..1.04 rows=4 width=16) (actual time=0.018..0.020 rows=4 loops=1)

18. 0.260 0.260 ↑ 1.0 1 10

Index Scan using plans_pkey on plans (cost=0.14..3.09 rows=1 width=9) (actual time=0.026..0.026 rows=1 loops=10)

  • Index Cond: (id = carrier_accounts.plan_id)
19. 0.140 0.140 ↑ 1.0 1 10

Index Scan using mncs_pkey on mncs pc_mncs (cost=0.28..8.30 rows=1 width=8) (actual time=0.013..0.014 rows=1 loops=10)

  • Index Cond: (id = phone_calls.mnc_id)
20. 0.050 0.050 ↑ 1.0 1 5

Index Only Scan using mncs_pkey on mncs pc_sim_mncs (cost=0.28..4.30 rows=1 width=4) (actual time=0.010..0.010 rows=1 loops=5)

  • Index Cond: (id = phone_calls.sim_mnc_id)
  • Heap Fetches: 0
21. 0.147 0.170 ↓ 1.2 6 5

HashAggregate (cost=1.42..1.48 rows=5 width=92) (actual time=0.022..0.034 rows=6 loops=5)

  • Group Key: roaming_days.carrier_account_id, roaming_days.country_id, roaming_days.filter_date
22. 0.023 0.023 ↑ 1.0 12 1

Seq Scan on roaming_days (cost=0.00..1.12 rows=12 width=44) (actual time=0.021..0.023 rows=12 loops=1)