explain.depesz.com

PostgreSQL's explain analyze made readable

Result: wohL

Settings
# exclusive inclusive rows x rows loops node
1. 0.825 82.199 ↑ 1.0 61 1

CTE Scan on managers m (cost=236.69..296,505.75 rows=63 width=84) (actual time=0.108..82.199 rows=61 loops=1)

2.          

CTE managers

3. 0.096 0.458 ↑ 1.0 61 1

Nested Loop (cost=0.68..236.69 rows=63 width=36) (actual time=0.027..0.458 rows=61 loops=1)

4. 0.179 0.179 ↑ 1.0 61 1

Index Scan using partners_partnermanager_e8701ad4 on partners_partnermanager m_1 (cost=0.28..22.32 rows=63 width=8) (actual time=0.016..0.179 rows=61 loops=1)

  • Index Cond: (user_id < 500)
  • Filter: is_hired
  • Rows Removed by Filter: 55
5. 0.183 0.183 ↑ 1.0 1 61

Index Scan using profile_userconfig_user_id_key on profile_userconfig p (cost=0.41..3.40 rows=1 width=9) (actual time=0.003..0.003 rows=1 loops=61)

  • Index Cond: (user_id = m_1.user_id)
6.          

SubPlan (forCTE Scan)

7. 0.061 9.882 ↑ 1.0 1 61

Aggregate (cost=482.83..482.84 rows=1 width=8) (actual time=0.162..0.162 rows=1 loops=61)

8. 1.340 9.821 ↓ 0.0 0 61

Hash Join (cost=27.29..482.81 rows=8 width=4) (actual time=0.161..0.161 rows=0 loops=61)

  • Hash Cond: (c.id = sd.contract_id)
9. 8.479 8.479 ↑ 3.5 134 61

Index Scan using partners_partnercontract_6bc80cbd on partners_partnercontract c (cost=0.41..454.71 rows=468 width=4) (actual time=0.005..0.139 rows=134 loops=61)

  • Index Cond: (account_manager_id = m.id)
10. 0.000 0.002 ↓ 0.0 0 1

Hash (cost=17.50..17.50 rows=750 width=8) (actual time=0.002..0.002 rows=0 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
11. 0.002 0.002 ↓ 0.0 0 1

Seq Scan on partners_partnercontractstatdata sd (cost=0.00..17.50 rows=750 width=8) (actual time=0.002..0.002 rows=0 loops=1)

12. 0.122 0.122 ↑ 1.0 1 61

Aggregate (cost=1,191.20..1,191.21 rows=1 width=8) (actual time=0.002..0.002 rows=1 loops=61)

13. 0.000 0.000 ↓ 0.0 0 61

Nested Loop (cost=0.58..1,190.28 rows=370 width=0) (actual time=0.000..0.000 rows=0 loops=61)

14. 0.000 0.000 ↓ 0.0 0 61

Nested Loop (cost=0.29..328.18 rows=370 width=4) (actual time=0.000..0.000 rows=0 loops=61)

15. 0.000 0.000 ↓ 0.0 0 61

Seq Scan on partners_partnerstatdata sd_1 (cost=0.00..17.40 rows=370 width=4) (actual time=0.000..0.000 rows=0 loops=61)

  • Filter: is_reactivated
16. 0.000 0.000 ↓ 0.0 0

Index Only Scan using partners_partner_pkey on partners_partner p_1 (cost=0.29..0.84 rows=1 width=4) (never executed)

  • Index Cond: (id = sd_1.partner_id)
  • Heap Fetches: 0
17. 0.000 0.000 ↓ 0.0 0

Limit (cost=0.29..2.31 rows=1 width=18,493) (never executed)

18. 0.000 0.000 ↓ 0.0 0

Index Scan using partners_partnercontract_4e98b6eb on partners_partnercontract c_1 (cost=0.29..2.31 rows=1 width=18,493) (never executed)

  • Index Cond: (partner_id = p_1.id)
  • Filter: (account_manager_id = m.id)
19. 0.000 0.366 ↓ 0.0 0 61

Nested Loop (cost=510.09..512.13 rows=1 width=32) (actual time=0.006..0.006 rows=0 loops=61)

20. 0.061 0.366 ↓ 0.0 0 61

Limit (cost=509.81..509.82 rows=1 width=12) (actual time=0.006..0.006 rows=0 loops=61)

21. 0.183 0.305 ↓ 0.0 0 61

Sort (cost=509.81..510.04 rows=90 width=12) (actual time=0.005..0.005 rows=0 loops=61)

  • Sort Key: (count(*)) DESC
  • Sort Method: quicksort Memory: 25kB
22. 0.122 0.122 ↓ 0.0 0 61

HashAggregate (cost=508.46..509.36 rows=90 width=12) (actual time=0.002..0.002 rows=0 loops=61)

  • Group Key: c_2.account_manager_id
23. 0.000 0.000 ↓ 0.0 0 61

Nested Loop (cost=0.58..507.32 rows=229 width=4) (actual time=0.000..0.000 rows=0 loops=61)

24. 0.000 0.000 ↓ 0.0 0 61

Nested Loop (cost=0.29..328.18 rows=370 width=8) (actual time=0.000..0.000 rows=0 loops=61)

25. 0.000 0.000 ↓ 0.0 0 61

Seq Scan on partners_partnerstatdata sd_2 (cost=0.00..17.40 rows=370 width=4) (actual time=0.000..0.000 rows=0 loops=61)

  • Filter: is_reactivated
26. 0.000 0.000 ↓ 0.0 0

Index Only Scan using partners_partner_pkey on partners_partner p_2 (cost=0.29..0.84 rows=1 width=4) (never executed)

  • Index Cond: (id = sd_2.partner_id)
  • Heap Fetches: 0
27. 0.000 0.000 ↓ 0.0 0

Index Scan using partners_partnercontract_4e98b6eb on partners_partnercontract c_2 (cost=0.29..0.47 rows=1 width=8) (never executed)

  • Index Cond: (partner_id = p_2.id)
  • Filter: ((brand)::text = (m.brand)::text)
28. 0.000 0.000 ↓ 0.0 0

Index Scan using auth_user_pkey on auth_user u (cost=0.28..2.30 rows=1 width=20) (never executed)

  • Index Cond: (id = c_2.account_manager_id)
29. 0.061 0.366 ↑ 1.0 1 61

Aggregate (cost=5.35..5.36 rows=1 width=8) (actual time=0.006..0.006 rows=1 loops=61)

30. 0.305 0.305 ↑ 3.5 2 61

Index Only Scan using idx_contract_punishment_rules_account on partners_partnercontract c_3 (cost=0.28..5.33 rows=7 width=0) (actual time=0.003..0.005 rows=2 loops=61)

  • Index Cond: (account_manager_id = m.id)
  • Heap Fetches: 85
31. 0.061 30.561 ↑ 1.0 1 61

Aggregate (cost=1,015.63..1,015.64 rows=1 width=8) (actual time=0.501..0.501 rows=1 loops=61)

32. 6.676 30.500 ↑ 2.0 1 61

Nested Loop (cost=0.70..1,015.63 rows=2 width=0) (actual time=0.169..0.500 rows=1 loops=61)

33. 7.320 7.320 ↑ 3.5 135 61

Index Scan using partners_partnercontract_6bc80cbd on partners_partnercontract c_4 (cost=0.41..454.71 rows=468 width=4) (actual time=0.003..0.120 rows=135 loops=61)

  • Index Cond: (account_manager_id = m.id)
34. 16.504 16.504 ↓ 0.0 0 8,252

Index Scan using partners_partnercreditrisk_contract_id_key on partners_partnercreditrisk cr (cost=0.29..1.20 rows=1 width=4) (actual time=0.002..0.002 rows=0 loops=8,252)

  • Index Cond: (contract_id = c_4.id)
  • Filter: (due_30_days IS NOT NULL)
  • Rows Removed by Filter: 1
35. 0.061 11.590 ↑ 1.0 1 61

Aggregate (cost=478.29..478.30 rows=1 width=8) (actual time=0.190..0.190 rows=1 loops=61)

36. 1.279 11.529 ↓ 0.0 0 61

Hash Join (cost=22.75..478.28 rows=4 width=0) (actual time=0.189..0.189 rows=0 loops=61)

  • Hash Cond: (c_5.partner_id = sd_3.partner_id)
37. 10.248 10.248 ↑ 3.5 134 61

Index Scan using partners_partnercontract_6bc80cbd on partners_partnercontract c_5 (cost=0.41..454.71 rows=468 width=4) (actual time=0.004..0.168 rows=134 loops=61)

  • Index Cond: (account_manager_id = m.id)
38. 0.001 0.002 ↓ 0.0 0 1

Hash (cost=19.25..19.25 rows=247 width=4) (actual time=0.002..0.002 rows=0 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
39. 0.001 0.001 ↓ 0.0 0 1

Seq Scan on partners_partnerstatdata sd_3 (cost=0.00..19.25 rows=247 width=4) (actual time=0.001..0.001 rows=0 loops=1)

  • Filter: (avg_cancellation_percent_month >= 55)
40. 0.061 28.487 ↑ 1.0 1 61

Aggregate (cost=1,017.18..1,017.19 rows=1 width=8) (actual time=0.467..0.467 rows=1 loops=61)

41. 5.578 28.426 ↓ 0.0 0 61

Nested Loop (cost=0.70..1,016.79 rows=154 width=0) (actual time=0.226..0.466 rows=0 loops=61)

42. 6.344 6.344 ↑ 3.5 135 61

Index Scan using partners_partnercontract_6bc80cbd on partners_partnercontract c_6 (cost=0.41..454.71 rows=468 width=4) (actual time=0.003..0.104 rows=135 loops=61)

  • Index Cond: (account_manager_id = m.id)
43. 16.504 16.504 ↓ 0.0 0 8,252

Index Scan using partners_partnercreditrisk_contract_id_key on partners_partnercreditrisk cr_1 (cost=0.29..1.20 rows=1 width=4) (actual time=0.002..0.002 rows=0 loops=8,252)

  • Index Cond: (contract_id = c_6.id)
  • Filter: (credit_limit_remain_share <= 30)
  • Rows Removed by Filter: 1
Planning time : 4.275 ms
Execution time : 82.705 ms