explain.depesz.com

PostgreSQL's explain analyze made readable

Result: fL0

Settings
# exclusive inclusive rows x rows loops node
1. 8.840 2,034.589 ↓ 31.9 24,003 1

Nested Loop (cost=2.68..366,542.87 rows=752 width=152) (actual time=0.248..2,034.589 rows=24,003 loops=1)

2. 1.365 1.365 ↑ 1.0 752 1

Seq Scan on auth_user u (cost=0.00..418.33 rows=752 width=4) (actual time=0.005..1.365 rows=752 loops=1)

  • Filter: is_active
  • Rows Removed by Filter: 1881
3. 109.468 2,024.384 ↓ 32.0 32 752

Nested Loop Semi Join (cost=2.68..486.85 rows=1 width=152) (actual time=0.023..2.692 rows=32 loops=752)

  • Join Filter: (p.id = c_2.partner_id)
4. 4.820 339.904 ↑ 1.4 35 752

Nested Loop Anti Join (cost=1.43..296.90 rows=48 width=29) (actual time=0.009..0.452 rows=35 loops=752)

5. 22.656 200.784 ↑ 1.4 36 752

Nested Loop (cost=0.85..256.97 rows=51 width=29) (actual time=0.008..0.267 rows=36 loops=752)

6. 8.456 70.688 ↑ 1.4 36 752

Nested Loop (cost=0.56..240.49 rows=51 width=20) (actual time=0.007..0.094 rows=36 loops=752)

7. 2.256 2.256 ↑ 1.0 1 752

Index Scan using partners_partnermanager_e8701ad4 on partners_partnermanager m (cost=0.28..2.29 rows=1 width=8) (actual time=0.003..0.003 rows=1 loops=752)

  • Index Cond: (user_id = u.id)
8. 59.976 59.976 ↑ 4.3 56 476

Index Scan using partners_partnercontract_3f984797 on partners_partnercontract c (cost=0.29..235.80 rows=239 width=20) (actual time=0.005..0.126 rows=56 loops=476)

  • Index Cond: (sales_manager_id = m.id)
9. 107.440 107.440 ↑ 1.0 1 26,860

Index Scan using partners_partner_pkey on partners_partner p (cost=0.29..0.32 rows=1 width=9) (actual time=0.004..0.004 rows=1 loops=26,860)

  • Index Cond: (id = c.partner_id)
10. 16.304 134.300 ↓ 0.0 0 26,860

Nested Loop (cost=0.58..0.77 rows=1 width=4) (actual time=0.005..0.005 rows=0 loops=26,860)

11. 107.440 107.440 ↓ 0.0 0 26,860

Index Scan using idx_partner_contract_is_involved on partners_partnercontract c_1 (cost=0.29..0.42 rows=1 width=8) (actual time=0.003..0.004 rows=0 loops=26,860)

  • Index Cond: (partner_id = p.id)
  • Filter: (NOT is_active_in_user_area)
  • Rows Removed by Filter: 1
12. 10.556 10.556 ↓ 0.0 0 5,278

Index Only Scan using idx_contract_data_not_terminated on partners_partnercontractdata cd (cost=0.29..0.34 rows=1 width=4) (actual time=0.002..0.002 rows=0 loops=5,278)

  • Index Cond: (contract_id = c_1.id)
  • Heap Fetches: 80
13. 48.772 398.865 ↑ 1.0 1 26,591

Nested Loop (cost=1.25..3.53 rows=1 width=4) (actual time=0.015..0.015 rows=1 loops=26,591)

  • Join Filter: ((m_1.user_id = uc.user_id) AND ((c_2.brand)::text = (CASE WHEN ((uc.brand)::text = 'ratehawk'::text) THEN uc.brand ELSE 'ostrovok'::character varying END)::text))
  • Rows Removed by Join Filter: 0
14. 23.651 265.910 ↑ 1.0 1 26,591

Nested Loop (cost=0.84..1.12 rows=1 width=21) (actual time=0.010..0.010 rows=1 loops=26,591)

15. 22.153 186.137 ↑ 1.0 1 26,591

Nested Loop (cost=0.56..0.69 rows=1 width=17) (actual time=0.007..0.007 rows=1 loops=26,591)

16. 106.364 106.364 ↑ 1.0 1 26,591

Index Scan using partners_partnercontract_4e98b6eb on partners_partnercontract c_2 (cost=0.29..0.40 rows=1 width=17) (actual time=0.004..0.004 rows=1 loops=26,591)

  • Index Cond: (partner_id = c.partner_id)
17. 57.620 57.620 ↑ 1.0 1 28,810

Index Scan using partners_partnermanager_pkey on partners_partnermanager m_1 (cost=0.28..0.29 rows=1 width=8) (actual time=0.002..0.002 rows=1 loops=28,810)

  • Index Cond: (id = c_2.sales_manager_id)
18. 56.122 56.122 ↑ 1.0 1 28,061

Index Only Scan using auth_user_pkey on auth_user u_1 (cost=0.28..0.43 rows=1 width=4) (actual time=0.002..0.002 rows=1 loops=28,061)

  • Index Cond: (id = m_1.user_id)
  • Heap Fetches: 4723
19. 84.183 84.183 ↑ 1.0 1 28,061

Index Scan using profile_userconfig_user_id_key on profile_userconfig uc (cost=0.41..2.40 rows=1 width=9) (actual time=0.003..0.003 rows=1 loops=28,061)

  • Index Cond: (user_id = u_1.id)
20.          

SubPlan (forNested Loop Semi Join)

21. 48.006 360.045 ↑ 1.0 1 24,003

Aggregate (cost=3.91..3.92 rows=1 width=8) (actual time=0.015..0.015 rows=1 loops=24,003)

22. 24.003 312.039 ↓ 0.0 0 24,003

Bitmap Heap Scan on crm_asterisk_attachedcall call (cost=2.89..3.91 rows=1 width=0) (actual time=0.013..0.013 rows=0 loops=24,003)

  • Recheck Cond: ((((related_to_model)::text = 'Partner'::text) AND (related_to_id = c.partner_id)) OR (((related_to_model)::text = 'PartnerContract'::text) AND (related_to_id = c.id)))
  • Filter: (created_by_id = $0)
  • Rows Removed by Filter: 0
  • Heap Blocks: exact=3380
23. 0.000 288.036 ↓ 0.0 0 24,003

BitmapOr (cost=2.89..2.89 rows=1 width=0) (actual time=0.012..0.012 rows=0 loops=24,003)

24. 144.018 144.018 ↓ 0.0 0 24,003

Bitmap Index Scan on idx_crm_asterisk_attachedcall_related (cost=0.00..1.44 rows=1 width=0) (actual time=0.006..0.006 rows=0 loops=24,003)

  • Index Cond: (((related_to_model)::text = 'Partner'::text) AND (related_to_id = c.partner_id))
25. 144.018 144.018 ↓ 0.0 0 24,003

Bitmap Index Scan on idx_crm_asterisk_attachedcall_related (cost=0.00..1.44 rows=1 width=0) (actual time=0.006..0.006 rows=0 loops=24,003)

  • Index Cond: (((related_to_model)::text = 'PartnerContract'::text) AND (related_to_id = c.id))
26. 48.006 336.042 ↑ 1.0 1 24,003

Aggregate (cost=3.89..3.90 rows=1 width=8) (actual time=0.014..0.014 rows=1 loops=24,003)

27. 24.003 288.036 ↓ 0.0 0 24,003

Bitmap Heap Scan on action_log_action al (cost=2.86..3.88 rows=1 width=0) (actual time=0.012..0.012 rows=0 loops=24,003)

  • Recheck Cond: ((((related_to_model)::text = 'Partner'::text) AND (related_to_id = c.partner_id)) OR (((related_to_model)::text = 'PartnerContract'::text) AND (related_to_id = c.id)))
  • Filter: (created_by_id = $0)
  • Rows Removed by Filter: 0
  • Heap Blocks: exact=6744
28. 24.003 264.033 ↓ 0.0 0 24,003

BitmapOr (cost=2.86..2.86 rows=1 width=0) (actual time=0.011..0.011 rows=0 loops=24,003)

29. 120.015 120.015 ↓ 0.0 0 24,003

Bitmap Index Scan on idx_action_log_instance__index (cost=0.00..1.43 rows=1 width=0) (actual time=0.005..0.005 rows=0 loops=24,003)

  • Index Cond: (((related_to_model)::text = 'Partner'::text) AND (related_to_id = c.partner_id))
30. 120.015 120.015 ↓ 0.0 0 24,003

Bitmap Index Scan on idx_action_log_instance__index (cost=0.00..1.43 rows=1 width=0) (actual time=0.005..0.005 rows=0 loops=24,003)

  • Index Cond: (((related_to_model)::text = 'PartnerContract'::text) AND (related_to_id = c.id))
31. 48.006 288.036 ↑ 1.0 1 24,003

Result (cost=5.95..5.96 rows=1 width=32) (actual time=0.012..0.012 rows=1 loops=24,003)

32.          

Initplan (forResult)

33. 72.009 240.030 ↓ 0.0 0 24,003

Sort (cost=5.94..5.95 rows=1 width=12) (actual time=0.010..0.010 rows=0 loops=24,003)

  • Sort Key: r.remind_dt
  • Sort Method: quicksort Memory: 25kB
34. 24.003 168.021 ↓ 0.0 0 24,003

Bitmap Heap Scan on reminds_remind r (cost=2.85..5.93 rows=1 width=12) (actual time=0.007..0.007 rows=0 loops=24,003)

  • Recheck Cond: ((related_to_id = c.partner_id) OR (related_to_id = c.id))
  • Filter: ((created_by_id = $0) AND (remind_dt >= now()) AND ((((related_to_model)::text = 'Partner'::text) AND (related_to_id = c.partner_id)) OR (((related_to_model)::text = 'PartnerContract'::text) AND (related_to_id = c.id))))
  • Rows Removed by Filter: 0
  • Heap Blocks: exact=9576
35. 24.003 144.018 ↓ 0.0 0 24,003

BitmapOr (cost=2.85..2.85 rows=3 width=0) (actual time=0.006..0.006 rows=0 loops=24,003)

36. 72.009 72.009 ↓ 0.0 0 24,003

Bitmap Index Scan on reminds_remind_f1e30255 (cost=0.00..1.43 rows=1 width=0) (actual time=0.003..0.003 rows=0 loops=24,003)

  • Index Cond: (related_to_id = c.partner_id)
37. 48.006 48.006 ↓ 0.0 0 24,003

Bitmap Index Scan on reminds_remind_f1e30255 (cost=0.00..1.43 rows=1 width=0) (actual time=0.002..0.002 rows=0 loops=24,003)

  • Index Cond: (related_to_id = c.id)
38. 48.006 192.024 ↑ 1.0 1 24,003

Aggregate (cost=5.94..5.95 rows=1 width=32) (actual time=0.008..0.008 rows=1 loops=24,003)

39. 24.003 144.018 ↓ 0.0 0 24,003

Bitmap Heap Scan on reminds_remind r_1 (cost=2.85..5.93 rows=1 width=8) (actual time=0.006..0.006 rows=0 loops=24,003)

  • Recheck Cond: ((related_to_id = c.partner_id) OR (related_to_id = c.id))
  • Filter: ((created_by_id = $0) AND (remind_dt >= now()) AND ((((related_to_model)::text = 'Partner'::text) AND (related_to_id = c.partner_id)) OR (((related_to_model)::text = 'PartnerContract'::text) AND (related_to_id = c.id))))
  • Rows Removed by Filter: 0
  • Heap Blocks: exact=9576
40. 24.003 120.015 ↓ 0.0 0 24,003

BitmapOr (cost=2.85..2.85 rows=3 width=0) (actual time=0.005..0.005 rows=0 loops=24,003)

41. 48.006 48.006 ↓ 0.0 0 24,003

Bitmap Index Scan on reminds_remind_f1e30255 (cost=0.00..1.43 rows=1 width=0) (actual time=0.002..0.002 rows=0 loops=24,003)

  • Index Cond: (related_to_id = c.partner_id)
42. 48.006 48.006 ↓ 0.0 0 24,003

Bitmap Index Scan on reminds_remind_f1e30255 (cost=0.00..1.43 rows=1 width=0) (actual time=0.002..0.002 rows=0 loops=24,003)

  • Index Cond: (related_to_id = c.id)
Planning time : 6.037 ms
Execution time : 2,037.929 ms