explain.depesz.com

PostgreSQL's explain analyze made readable

Result: UFa2

Settings
# exclusive inclusive rows x rows loops node
1. 0.007 43.038 ↓ 0.0 0 1

Subquery Scan on phone_calls_with_total_roaming_country_usage (cost=26.13..26.45 rows=1 width=1,350) (actual time=43.038..43.038 rows=0 loops=1)

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

WindowAgg (cost=26.13..26.43 rows=1 width=1,362) (actual time=42.939..43.031 rows=5 loops=1)

3. 0.034 42.835 ↓ 5.0 5 1

Sort (cost=26.13..26.13 rows=1 width=1,314) (actual time=42.833..42.835 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.567 42.801 ↓ 5.0 5 1

GroupAggregate (cost=25.82..26.12 rows=1 width=1,314) (actual time=42.630..42.801 rows=5 loops=1)

  • Group Key: phone_calls.id, plans.rate_type, carrier_accounts.contract_start_date
5. 0.089 42.234 ↓ 5.0 5 1

Sort (cost=25.82..25.83 rows=1 width=1,262) (actual time=42.232..42.234 rows=5 loops=1)

  • Sort Key: phone_calls.id, plans.rate_type, carrier_accounts.contract_start_date
  • Sort Method: quicksort Memory: 26kB
6. 0.139 42.145 ↓ 5.0 5 1

Nested Loop Left Join (cost=4.04..25.81 rows=1 width=1,262) (actual time=41.849..42.145 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
7. 0.014 41.956 ↓ 5.0 5 1

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

8. 0.025 41.727 ↓ 5.0 5 1

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

  • Join Filter: (tariffs.country_id = pc_mncs.country_id)
  • Rows Removed by Join Filter: 5
9. 0.045 41.452 ↓ 10.0 10 1

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

10. 40.918 41.307 ↓ 5.0 10 1

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

  • Hash Cond: (carrier_accounts.plan_id = tariffs.plan_id)
11. 0.078 0.154 ↑ 1.0 5 1

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

  • Hash Cond: (carrier_accounts.id = phone_calls.carrier_account_id)
12. 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.029..0.034 rows=15 loops=1)

13. 0.023 0.042 ↑ 1.0 5 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
14. 0.019 0.019 ↑ 1.0 5 1

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

15. 0.057 0.235 ↓ 2.0 4 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
16. 0.081 0.178 ↓ 2.0 4 1

Hash Join (cost=1.09..2.21 rows=2 width=16) (actual time=0.160..0.178 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
17. 0.049 0.049 ↑ 1.0 4 1

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

18. 0.032 0.048 ↑ 1.0 4 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
19. 0.016 0.016 ↑ 1.0 4 1

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

20. 0.100 0.100 ↑ 1.0 1 10

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

  • Index Cond: (id = carrier_accounts.plan_id)
21. 0.250 0.250 ↑ 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.024..0.025 rows=1 loops=10)

  • Index Cond: (id = phone_calls.mnc_id)
22. 0.215 0.215 ↑ 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.043..0.043 rows=1 loops=5)

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

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

Planning time : 23.050 ms