explain.depesz.com

PostgreSQL's explain analyze made readable

Result: tQm4

Settings
# exclusive inclusive rows x rows loops node
1. 0.004 3.683 ↓ 0.0 0 1

Subquery Scan on phone_tmp_roaming (cost=26.07..26.39 rows=1 width=1,350) (actual time=3.683..3.683 rows=0 loops=1)

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

WindowAgg (cost=26.07..26.37 rows=1 width=1,354) (actual time=3.634..3.679 rows=5 loops=1)

3. 0.100 3.574 ↓ 5.0 5 1

Sort (cost=26.07..26.08 rows=1 width=1,262) (actual time=3.573..3.574 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.384 3.474 ↓ 5.0 5 1

Nested Loop Left Join (cost=4.04..26.06 rows=1 width=1,262) (actual time=3.246..3.474 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: 27
5. 0.009 3.070 ↓ 5.0 5 1

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

6. 0.016 3.021 ↓ 5.0 5 1

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

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

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

8. 0.080 2.848 ↓ 5.0 10 1

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

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

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

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

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

11. 0.021 0.055 ↑ 1.0 5 1

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

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

Seq Scan on phone_calls (cost=0.00..1.05 rows=5 width=1,221) (actual time=0.032..0.034 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.076 0.122 ↓ 2.0 4 1

Hash Join (cost=1.09..2.21 rows=2 width=16) (actual time=0.118..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.022 0.022 ↑ 1.0 4 1

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

16. 0.015 0.024 ↑ 1.0 4 1

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

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

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

18. 0.040 0.040 ↑ 1.0 1 10

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

  • Index Cond: (id = carrier_accounts.plan_id)
19. 0.090 0.090 ↑ 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.009..0.009 rows=1 loops=10)

  • Index Cond: (id = phone_calls.mnc_id)
20. 0.040 0.040 ↑ 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.008..0.008 rows=1 loops=5)

  • Index Cond: (id = phone_calls.sim_mnc_id)
  • Heap Fetches: 0
21. 0.020 0.020 ↑ 2.0 6 5

Seq Scan on roaming_days (cost=0.00..1.12 rows=12 width=44) (actual time=0.003..0.004 rows=6 loops=5)