explain.depesz.com

PostgreSQL's explain analyze made readable

Result: yQxJ

Settings
# exclusive inclusive rows x rows loops node
1. 0.889 554.218 ↓ 111.0 111 1

Subquery Scan on temp (cost=1,125.78..1,471.86 rows=1 width=183) (actual time=546.211..554.218 rows=111 loops=1)

  • Filter: ((temp.filter_date >= '2018-03-01'::date) AND (temp.filter_date <= '2018-03-31'::date))
  • Rows Removed by Filter: 8471
  • Planning time: 1.763 ms
  • Execution time: 554.360 ms
2. 9.117 553.329 ↓ 1.5 8,582 1

WindowAgg (cost=1,125.78..1,448.78 rows=5,768 width=155) (actual time=543.405..553.329 rows=8,582 loops=1)

3. 11.664 544.212 ↓ 1.5 8,582 1

Sort (cost=1,125.78..1,128.66 rows=5,768 width=155) (actual time=543.374..544.212 rows=8,582 loops=1)

  • Sort Key: phone_calls.carrier_account_id, (period_start(phone_calls.filter_date, carrier_accounts.contract_start_date))
  • Sort Method: quicksort Memory: 2664kB
4. 445.259 532.548 ↓ 1.5 8,582 1

Hash Join (cost=224.44..1,053.71 rows=5,768 width=155) (actual time=83.748..532.548 rows=8,582 loops=1)

  • Hash Cond: ((phone_calls.mnc_id = pc_mncs.id) AND (phone_calls.carrier_account_id = carrier_accounts.id))
5. 3.739 3.739 ↑ 1.0 25,508 1

Seq Scan on phone_calls (cost=0.00..762.52 rows=25,508 width=150) (actual time=0.005..3.739 rows=25,508 loops=1)

6. 14.480 83.550 ↓ 8.3 50,733 1

Hash (cost=199.90..199.90 rows=6,133 width=13) (actual time=83.550..83.550 rows=50,733 loops=1)

  • Buckets: 65536 (originally 8192) Batches: 1 (originally 1) Memory Usage: 2742kB
7. 16.061 69.070 ↓ 8.3 50,733 1

Merge Join (cost=4.21..199.90 rows=6,133 width=13) (actual time=0.078..69.070 rows=50,733 loops=1)

  • Merge Cond: (carrier_accounts.plan_id = plans.id)
8. 12.170 48.223 ↓ 1.9 50,733 1

Nested Loop (cost=0.14..1,112.46 rows=26,348 width=20) (actual time=0.019..48.223 rows=50,733 loops=1)

9. 3.959 9.845 ↓ 1.9 6,552 1

Merge Join (cost=0.09..608.23 rows=3,400 width=20) (actual time=0.014..9.845 rows=6,552 loops=1)

  • Merge Cond: (carrier_accounts.plan_id = tariffs.plan_id)
10. 0.044 0.044 ↑ 2.9 28 1

Index Scan using index_carrier_accounts_on_plan_id on carrier_accounts (cost=0.03..27.76 rows=82 width=12) (actual time=0.005..0.044 rows=28 loops=1)

11. 5.842 5.842 ↓ 1.1 30,120 1

Index Scan using index_tariffs_on_plan_id on tariffs (cost=0.06..580.81 rows=26,240 width=8) (actual time=0.006..5.842 rows=30,120 loops=1)

12. 26.208 26.208 ↑ 1.1 8 6,552

Index Scan using index_mncs_on_country_id on mncs pc_mncs (cost=0.06..0.12 rows=9 width=8) (actual time=0.002..0.004 rows=8 loops=6,552)

  • Index Cond: (country_id = tariffs.country_id)
13. 4.752 4.786 ↓ 414.6 45,194 1

Sort (cost=4.06..4.12 rows=109 width=5) (actual time=0.058..4.786 rows=45,194 loops=1)

  • Sort Key: plans.id
  • Sort Method: quicksort Memory: 30kB
14. 0.034 0.034 ↓ 1.0 110 1

Seq Scan on plans (cost=0.00..3.33 rows=109 width=5) (actual time=0.004..0.034 rows=110 loops=1)