explain.depesz.com

PostgreSQL's explain analyze made readable

Result: RAF8

Settings
# exclusive inclusive rows x rows loops node
1. 4.553 992.832 ↓ 15.1 11,337 1

Nested Loop (cost=2.39..270,123.13 rows=750 width=152) (actual time=0.241..992.832 rows=11,337 loops=1)

2. 1.279 1.279 ↑ 1.0 750 1

Seq Scan on auth_user u (cost=0.00..418.29 rows=750 width=4) (actual time=0.010..1.279 rows=750 loops=1)

  • Filter: is_active
  • Rows Removed by Filter: 1879
3. 68.741 987.000 ↓ 15.0 15 750

Nested Loop Semi Join (cost=2.39..359.59 rows=1 width=152) (actual time=0.028..1.316 rows=15 loops=750)

  • Join Filter: (p.id = c_2.partner_id)
4. 25.832 249.000 ↑ 1.1 16 750

Nested Loop Anti Join (cost=1.14..274.84 rows=18 width=29) (actual time=0.014..0.332 rows=16 loops=750)

5. 27.498 169.500 ↑ 1.4 36 750

Nested Loop (cost=0.85..253.60 rows=50 width=29) (actual time=0.007..0.226 rows=36 loops=750)

6. 7.626 61.500 ↑ 1.4 36 750

Nested Loop (cost=0.56..237.43 rows=50 width=20) (actual time=0.006..0.082 rows=36 loops=750)

7. 2.250 2.250 ↑ 1.0 1 750

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=750)

  • Index Cond: (user_id = u.id)
8. 51.624 51.624 ↑ 4.2 56 478

Index Scan using partners_partnercontract_3f984797 on partners_partnercontract c (cost=0.29..232.77 rows=236 width=20) (actual time=0.004..0.108 rows=56 loops=478)

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

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

  • Index Cond: (id = c.partner_id)
10. 53.668 53.668 ↑ 1.0 1 26,834

Index Only Scan using idx_partner_contract_is_involved on partners_partnercontract c_1 (cost=0.29..0.42 rows=1 width=4) (actual time=0.002..0.002 rows=1 loops=26,834)

  • Index Cond: (partner_id = p.id)
  • Heap Fetches: 14596
11. 24.416 159.094 ↑ 1.0 1 12,238

Nested Loop (cost=1.25..3.60 rows=1 width=4) (actual time=0.013..0.013 rows=1 loops=12,238)

  • 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
12. 0.000 110.142 ↑ 1.0 1 12,238

Nested Loop (cost=0.84..1.18 rows=1 width=21) (actual time=0.009..0.009 rows=1 loops=12,238)

13. 24.396 85.666 ↑ 1.0 1 12,238

Nested Loop (cost=0.56..0.69 rows=1 width=17) (actual time=0.006..0.007 rows=1 loops=12,238)

14. 36.714 36.714 ↑ 1.0 1 12,238

Index Scan using partners_partnercontract_4e98b6eb on partners_partnercontract c_2 (cost=0.29..0.40 rows=1 width=17) (actual time=0.003..0.003 rows=1 loops=12,238)

  • Index Cond: (partner_id = c.partner_id)
15. 24.556 24.556 ↑ 1.0 1 12,278

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=12,278)

  • Index Cond: (id = c_2.sales_manager_id)
16. 24.536 24.536 ↑ 1.0 1 12,268

Index Only Scan using auth_user_pkey on auth_user u_1 (cost=0.28..0.49 rows=1 width=4) (actual time=0.002..0.002 rows=1 loops=12,268)

  • Index Cond: (id = m_1.user_id)
  • Heap Fetches: 6412
17. 24.536 24.536 ↑ 1.0 1 12,268

Index Scan using profile_userconfig_user_id_key on profile_userconfig uc (cost=0.41..2.40 rows=1 width=10) (actual time=0.002..0.002 rows=1 loops=12,268)

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

SubPlan (forNested Loop Semi Join)

19. 22.674 158.718 ↑ 1.0 1 11,337

Aggregate (cost=3.91..3.92 rows=1 width=8) (actual time=0.014..0.014 rows=1 loops=11,337)

20. 0.000 136.044 ↓ 0.0 0 11,337

Bitmap Heap Scan on crm_asterisk_attachedcall call (cost=2.89..3.91 rows=1 width=0) (actual time=0.012..0.012 rows=0 loops=11,337)

  • 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=1434
21. 11.337 136.044 ↓ 0.0 0 11,337

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

22. 68.022 68.022 ↓ 0.0 0 11,337

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=11,337)

  • Index Cond: (((related_to_model)::text = 'Partner'::text) AND (related_to_id = c.partner_id))
23. 56.685 56.685 ↓ 0.0 0 11,337

Bitmap Index Scan on idx_crm_asterisk_attachedcall_related (cost=0.00..1.44 rows=1 width=0) (actual time=0.005..0.005 rows=0 loops=11,337)

  • Index Cond: (((related_to_model)::text = 'PartnerContract'::text) AND (related_to_id = c.id))
24. 22.674 147.381 ↑ 1.0 1 11,337

Aggregate (cost=3.89..3.90 rows=1 width=8) (actual time=0.013..0.013 rows=1 loops=11,337)

25. 11.337 124.707 ↓ 0.0 0 11,337

Bitmap Heap Scan on action_log_action al (cost=2.86..3.88 rows=1 width=0) (actual time=0.011..0.011 rows=0 loops=11,337)

  • 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=3276
26. 0.000 113.370 ↓ 0.0 0 11,337

BitmapOr (cost=2.86..2.86 rows=1 width=0) (actual time=0.010..0.010 rows=0 loops=11,337)

27. 56.685 56.685 ↓ 0.0 0 11,337

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=11,337)

  • Index Cond: (((related_to_model)::text = 'Partner'::text) AND (related_to_id = c.partner_id))
28. 56.685 56.685 ↓ 0.0 0 11,337

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=11,337)

  • Index Cond: (((related_to_model)::text = 'PartnerContract'::text) AND (related_to_id = c.id))
29. 22.674 124.707 ↑ 1.0 1 11,337

Result (cost=5.95..5.96 rows=1 width=32) (actual time=0.011..0.011 rows=1 loops=11,337)

30.          

Initplan (forResult)

31. 22.674 102.033 ↓ 0.0 0 11,337

Sort (cost=5.94..5.95 rows=1 width=12) (actual time=0.009..0.009 rows=0 loops=11,337)

  • Sort Key: r.remind_dt
  • Sort Method: quicksort Memory: 25kB
32. 11.337 79.359 ↓ 0.0 0 11,337

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=11,337)

  • 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=3216
33. 11.337 68.022 ↓ 0.0 0 11,337

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

34. 34.011 34.011 ↓ 0.0 0 11,337

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=11,337)

  • Index Cond: (related_to_id = c.partner_id)
35. 22.674 22.674 ↓ 0.0 0 11,337

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=11,337)

  • Index Cond: (related_to_id = c.id)
36. 11.337 79.359 ↑ 1.0 1 11,337

Aggregate (cost=5.94..5.95 rows=1 width=32) (actual time=0.007..0.007 rows=1 loops=11,337)

37. 11.337 68.022 ↓ 0.0 0 11,337

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=11,337)

  • 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=3216
38. 11.337 56.685 ↓ 0.0 0 11,337

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

39. 22.674 22.674 ↓ 0.0 0 11,337

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=11,337)

  • Index Cond: (related_to_id = c.partner_id)
40. 22.674 22.674 ↓ 0.0 0 11,337

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=11,337)

  • Index Cond: (related_to_id = c.id)
Planning time : 4.804 ms
Execution time : 994.428 ms