explain.depesz.com

PostgreSQL's explain analyze made readable

Result: NQMW

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 0.000 ↓ 0.0

Limit (cost=75,347.79..98,413.14 rows=100 width=1,267) (actual rows= loops=)

2. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=70,734.73..119,836,597.50 rows=519,246 width=1,267) (actual rows= loops=)

3. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=70,734.30..20,604,040.99 rows=519,246 width=1,104) (actual rows= loops=)

4. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=70,733.87..20,354,722.92 rows=519,246 width=1,073) (actual rows= loops=)

5. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=70,733.44..20,105,404.86 rows=519,246 width=1,042) (actual rows= loops=)

6. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=70,733.02..19,856,086.80 rows=519,246 width=1,011) (actual rows= loops=)

7. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=70,732.59..19,606,768.74 rows=519,246 width=980) (actual rows= loops=)

8. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=70,732.16..19,357,450.67 rows=519,246 width=949) (actual rows= loops=)

9. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=70,731.73..19,108,132.61 rows=519,246 width=918) (actual rows= loops=)

10. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=70,731.31..18,858,814.55 rows=519,246 width=887) (actual rows= loops=)

11. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=70,730.88..18,609,496.49 rows=519,246 width=856) (actual rows= loops=)

12. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=70,730.45..18,360,178.42 rows=519,246 width=825) (actual rows= loops=)

13. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=70,730.02..18,110,860.36 rows=519,246 width=794) (actual rows= loops=)

14. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=70,729.60..17,861,542.30 rows=519,246 width=763) (actual rows= loops=)

15. 0.000 0.000 ↓ 0.0

Limit (cost=75,347.79..98,413.14 rows=100 width=1,267) (actual rows= loops=)

16. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=70,734.73..119,836,597.50 rows=519,246 width=1,267) (actual rows= loops=)

17. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=70,734.30..20,604,040.99 rows=519,246 width=1,104) (actual rows= loops=)

18. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=70,733.87..20,354,722.92 rows=519,246 width=1,073) (actual rows= loops=)

19. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=70,733.44..20,105,404.86 rows=519,246 width=1,042) (actual rows= loops=)

20. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=70,733.02..19,856,086.80 rows=519,246 width=1,011) (actual rows= loops=)

21. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=70,732.59..19,606,768.74 rows=519,246 width=980) (actual rows= loops=)

22. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=70,732.16..19,357,450.67 rows=519,246 width=949) (actual rows= loops=)

23. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=70,731.73..19,108,132.61 rows=519,246 width=918) (actual rows= loops=)

24. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=70,731.31..18,858,814.55 rows=519,246 width=887) (actual rows= loops=)

25. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=70,730.88..18,609,496.49 rows=519,246 width=856) (actual rows= loops=)

26. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=70,730.45..18,360,178.42 rows=519,246 width=825) (actual rows= loops=)

27. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=70,730.02..18,110,860.36 rows=519,246 width=794) (actual rows= loops=)

28. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=70,729.60..17,861,542.30 rows=519,246 width=763) (actual rows= loops=)

29. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=70,729.17..17,612,224.24 rows=519,246 width=732) (actual rows= loops=)

30. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=70,728.74..17,362,906.18 rows=519,246 width=701) (actual rows= loops=)

31. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=70,728.31..17,113,588.11 rows=519,246 width=670) (actual rows= loops=)

32. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=70,727.89..16,864,270.05 rows=519,246 width=639) (actual rows= loops=)

33. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=70,727.46..16,614,951.99 rows=519,246 width=608) (actual rows= loops=)

34. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=70,727.03..16,365,633.93 rows=519,246 width=577) (actual rows= loops=)

35. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=70,726.74..15,855,729.18 rows=519,246 width=560) (actual rows= loops=)

36. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=70,726.46..12,323,760.29 rows=519,246 width=560) (actual rows= loops=)

37. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=70,726.17..11,813,855.55 rows=519,246 width=543) (actual rows= loops=)

38. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=70,725.88..11,647,086.02 rows=519,246 width=543) (actual rows= loops=)

39. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=70,725.59..11,137,181.28 rows=519,246 width=526) (actual rows= loops=)

40. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=70,725.31..7,605,225.41 rows=519,246 width=526) (actual rows= loops=)

41. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=70,724.88..7,366,395.73 rows=519,246 width=520) (actual rows= loops=)

42. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=70,724.59..7,196,062.44 rows=519,246 width=471) (actual rows= loops=)

43. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=70,724.30..7,025,729.46 rows=519,246 width=422) (actual rows= loops=)

44. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=70,724.01..6,855,396.44 rows=519,246 width=373) (actual rows= loops=)

45. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=70,723.58..2,513,960.96 rows=519,246 width=365) (actual rows= loops=)

46. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=70,723.30..2,360,768.74 rows=519,246 width=365) (actual rows= loops=)

47. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=70,723.02..2,201,942.28 rows=519,246 width=355) (actual rows= loops=)

48. 0.000 0.000 ↓ 0.0

Nested Loop (cost=70,722.73..2,043,116.17 rows=519,246 width=337) (actual rows= loops=)

49. 0.000 0.000 ↓ 0.0

Nested Loop (cost=70,722.44..1,872,783.18 rows=519,246 width=288) (actual rows= loops=)

50. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=70,722.01..1,636,778.57 rows=519,246 width=279) (actual rows= loops=)

  • Filter: ((hlp.service_center_id = ANY ('{2638,2835}'::integer[])) OR (events.assign_to_tenant = 2,786) OR (dispatch_from.id IS NOT NULL) OR (dispatch_to.id IS NOT NULL))
51. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=70,721.72..1,464,436.78 rows=519,246 width=279) (actual rows= loops=)

52. 0.000 0.000 ↓ 0.0

Nested Loop (cost=70,721.42..1,294,691.22 rows=519,246 width=263) (actual rows= loops=)

53. 0.000 0.000 ↓ 0.0

Nested Loop (cost=70,721.13..901,381.62 rows=519,290 width=221) (actual rows= loops=)

54. 0.000 0.000 ↓ 0.0

Merge Join (cost=70,720.85..741,083.35 rows=524,059 width=207) (actual rows= loops=)

  • Merge Cond: (events.id = hlp.id)
55. 0.000 0.000 ↓ 0.0

Index Scan Backward using events_pkey on events (cost=0.43..651,962.20 rows=4,222,694 width=166) (actual rows= loops=)

56. 0.000 0.000 ↓ 0.0

Sort (cost=70,707.54..72,017.69 rows=524,059 width=45) (actual rows= loops=)

  • Sort Key: hlp.id DESC
57. 0.000 0.000 ↓ 0.0

Seq Scan on se_helper hlp (cost=0.00..20,923.59 rows=524,059 width=45) (actual rows= loops=)

58. 0.000 0.000 ↓ 0.0

Index Scan using users_pkey on users (cost=0.29..0.31 rows=1 width=22) (actual rows= loops=)

  • Index Cond: (id = events.created_by_user_id)
59. 0.000 0.000 ↓ 0.0

Index Scan using tenants_pkey on tenants user_tenants (cost=0.29..0.76 rows=1 width=50) (actual rows= loops=)

  • Index Cond: (id = users.tenant_id)
60. 0.000 0.000 ↓ 0.0

Index Scan using index_event_dispatches_on_event_id on event_dispatches dispatch_from (cost=0.29..0.32 rows=1 width=20) (actual rows= loops=)

  • Index Cond: (event_id = events.id)
  • Filter: (service_provider_id = ANY ('{2638,2835}'::integer[]))
61. 0.000 0.000 ↓ 0.0

Index Scan using index_event_dispatches_on_event_id on event_dispatches dispatch_to (cost=0.29..0.32 rows=1 width=16) (actual rows= loops=)

  • Index Cond: (event_id = events.id)
  • Filter: (call_center_id = ANY ('{2638,2835}'::integer[]))
62. 0.000 0.000 ↓ 0.0

Index Scan using equipments_pkey on equipments (cost=0.42..0.45 rows=1 width=13) (actual rows= loops=)

  • Index Cond: (id = events.equipment_id)
63. 0.000 0.000 ↓ 0.0

Index Scan using tenants_pkey on tenants iep_tenants (cost=0.29..0.33 rows=1 width=57) (actual rows= loops=)

  • Index Cond: (id = hlp.ep_tenant_id)
64. 0.000 0.000 ↓ 0.0

Index Scan using users_pkey on users drivers (cost=0.29..0.31 rows=1 width=22) (actual rows= loops=)

  • Index Cond: (id = events.driver_id)
65. 0.000 0.000 ↓ 0.0

Index Scan using users_pkey on users technician (cost=0.29..0.31 rows=1 width=18) (actual rows= loops=)

  • Index Cond: (id = events.assign_to_user)
66. 0.000 0.000 ↓ 0.0

Index Scan using ancillary_locations_pkey on ancillary_locations (cost=0.28..0.30 rows=1 width=8) (actual rows= loops=)

  • Index Cond: (id = events.ancillary_location_id)
67. 0.000 0.000 ↓ 0.0

Index Scan using addresses_pkey on addresses ancillary_location_addresses (cost=0.43..8.36 rows=1 width=16) (actual rows= loops=)

  • Index Cond: (id = ancillary_locations.address_id)
68. 0.000 0.000 ↓ 0.0

Index Scan using tenants_pkey on tenants td_tenants (cost=0.29..0.33 rows=1 width=57) (actual rows= loops=)

  • Index Cond: (id = hlp.td_tenant_id)
  • Filter: (deleted_at IS NULL)
69. 0.000 0.000 ↓ 0.0

Index Scan using tenants_pkey on tenants sp_tenants (cost=0.29..0.33 rows=1 width=57) (actual rows= loops=)

  • Index Cond: (id = hlp.sp_tenant_id)
  • Filter: (deleted_at IS NULL)
70. 0.000 0.000 ↓ 0.0

Index Scan using tenants_pkey on tenants shipper_tenants (cost=0.29..0.33 rows=1 width=57) (actual rows= loops=)

  • Index Cond: (id = hlp.sh_tenant_id)
  • Filter: (deleted_at IS NULL)
71. 0.000 0.000 ↓ 0.0

Index Scan using index_event_grades_on_event_id on event_grades (cost=0.42..0.45 rows=1 width=10) (actual rows= loops=)

  • Index Cond: (event_id = events.id)
72. 0.000 0.000 ↓ 0.0

Index Scan using service_centers_pkey on service_centers from_sc (cost=0.29..6.80 rows=1 width=8) (actual rows= loops=)

  • Index Cond: (id = dispatch_from.call_center_id)
73. 0.000 0.000 ↓ 0.0

Index Scan using tenants_pkey on tenants from_sct (cost=0.29..0.98 rows=1 width=25) (actual rows= loops=)

  • Index Cond: (id = from_sc.tenant_id)
74. 0.000 0.000 ↓ 0.0

Index Scan using service_centers_pkey on service_centers to_sc (cost=0.29..0.32 rows=1 width=8) (actual rows= loops=)

  • Index Cond: (id = dispatch_to.service_provider_id)
75. 0.000 0.000 ↓ 0.0

Index Scan using tenants_pkey on tenants to_sct (cost=0.29..0.98 rows=1 width=25) (actual rows= loops=)

  • Index Cond: (id = to_sc.tenant_id)
76. 0.000 0.000 ↓ 0.0

Index Scan using service_centers_pkey on service_centers to_child_sc (cost=0.29..6.80 rows=1 width=8) (actual rows= loops=)

  • Index Cond: (id = dispatch_from.service_provider_id)
77. 0.000 0.000 ↓ 0.0

Index Scan using tenants_pkey on tenants to_child_sct (cost=0.29..0.98 rows=1 width=25) (actual rows= loops=)

  • Index Cond: (id = to_child_sc.tenant_id)
78. 0.000 0.000 ↓ 0.0

Index Scan using index_custom_field_values_on_event_id_and_custom_field_id on custom_field_values custom_field_values_210 (cost=0.43..0.48 rows=1 width=35) (actual rows= loops=)

  • Index Cond: ((event_id = events.id) AND (custom_field_id = 210))
79. 0.000 0.000 ↓ 0.0

Index Scan using index_custom_field_values_on_event_id_and_custom_field_id on custom_field_values custom_field_values_211 (cost=0.43..0.48 rows=1 width=35) (actual rows= loops=)

  • Index Cond: ((event_id = events.id) AND (custom_field_id = 211))
80. 0.000 0.000 ↓ 0.0

Index Scan using index_custom_field_values_on_event_id_and_custom_field_id on custom_field_values custom_field_values_212 (cost=0.43..0.48 rows=1 width=35) (actual rows= loops=)

  • Index Cond: ((event_id = events.id) AND (custom_field_id = 212))
81. 0.000 0.000 ↓ 0.0

Index Scan using index_custom_field_values_on_event_id_and_custom_field_id on custom_field_values custom_field_values_217 (cost=0.43..0.48 rows=1 width=35) (actual rows= loops=)

  • Index Cond: ((event_id = events.id) AND (custom_field_id = 217))
82. 0.000 0.000 ↓ 0.0

Index Scan using index_custom_field_values_on_event_id_and_custom_field_id on custom_field_values custom_field_values_218 (cost=0.43..0.48 rows=1 width=35) (actual rows= loops=)

  • Index Cond: ((event_id = events.id) AND (custom_field_id = 218))
83. 0.000 0.000 ↓ 0.0

Index Scan using index_custom_field_values_on_event_id_and_custom_field_id on custom_field_values custom_field_values_219 (cost=0.43..0.48 rows=1 width=35) (actual rows= loops=)

  • Index Cond: ((event_id = events.id) AND (custom_field_id = 219))
84. 0.000 0.000 ↓ 0.0

Index Scan using index_custom_field_values_on_event_id_and_custom_field_id on custom_field_values custom_field_values_220 (cost=0.43..0.48 rows=1 width=35) (actual rows= loops=)

  • Index Cond: ((event_id = events.id) AND (custom_field_id = 220))
85. 0.000 0.000 ↓ 0.0

Index Scan using index_custom_field_values_on_event_id_and_custom_field_id on custom_field_values custom_field_values_221 (cost=0.43..0.48 rows=1 width=35) (actual rows= loops=)

  • Index Cond: ((event_id = events.id) AND (custom_field_id = 221))
86. 0.000 0.000 ↓ 0.0

Index Scan using index_custom_field_values_on_event_id_and_custom_field_id on custom_field_values custom_field_values_222 (cost=0.43..0.48 rows=1 width=35) (actual rows= loops=)

  • Index Cond: ((event_id = events.id) AND (custom_field_id = 222))
87. 0.000 0.000 ↓ 0.0

Index Scan using index_custom_field_values_on_event_id_and_custom_field_id on custom_field_values custom_field_values_223 (cost=0.43..0.48 rows=1 width=35) (actual rows= loops=)

  • Index Cond: ((event_id = events.id) AND (custom_field_id = 223))
88. 0.000 0.000 ↓ 0.0

Index Scan using index_custom_field_values_on_event_id_and_custom_field_id on custom_field_values custom_field_values_253 (cost=0.43..0.48 rows=1 width=35) (actual rows= loops=)

  • Index Cond: ((event_id = events.id) AND (custom_field_id = 253))
89. 0.000 0.000 ↓ 0.0

Index Scan using index_custom_field_values_on_event_id_and_custom_field_id on custom_field_values custom_field_values_260 (cost=0.43..0.48 rows=1 width=35) (actual rows= loops=)

  • Index Cond: ((event_id = events.id) AND (custom_field_id = 260))
90. 0.000 0.000 ↓ 0.0

Index Scan using index_custom_field_values_on_event_id_and_custom_field_id on custom_field_values custom_field_values_277 (cost=0.43..0.48 rows=1 width=35) (actual rows= loops=)

  • Index Cond: ((event_id = events.id) AND (custom_field_id = 277))
91. 0.000 0.000 ↓ 0.0

Index Scan using index_custom_field_values_on_event_id_and_custom_field_id on custom_field_values custom_field_values_278 (cost=0.43..0.48 rows=1 width=35) (actual rows= loops=)

  • Index Cond: ((event_id = events.id) AND (custom_field_id = 278))
92. 0.000 0.000 ↓ 0.0

Index Scan using index_custom_field_values_on_event_id_and_custom_field_id on custom_field_values custom_field_values_538 (cost=0.43..0.48 rows=1 width=35) (actual rows= loops=)

  • Index Cond: ((event_id = events.id) AND (custom_field_id = 538))
93. 0.000 0.000 ↓ 0.0

Index Scan using index_custom_field_values_on_event_id_and_custom_field_id on custom_field_values custom_field_values_539 (cost=0.43..0.48 rows=1 width=35) (actual rows= loops=)

  • Index Cond: ((event_id = events.id) AND (custom_field_id = 539))
94. 0.000 0.000 ↓ 0.0

Index Scan using index_custom_field_values_on_event_id_and_custom_field_id on custom_field_values custom_field_values_1782 (cost=0.43..0.48 rows=1 width=35) (actual rows= loops=)

  • Index Cond: ((event_id = events.id) AND (custom_field_id = 1,782))
95. 0.000 0.000 ↓ 0.0

Index Scan using index_custom_field_values_on_event_id_and_custom_field_id on custom_field_values custom_field_values_1820 (cost=0.43..0.48 rows=1 width=35) (actual rows= loops=)

  • Index Cond: ((event_id = events.id) AND (custom_field_id = 1,820))
96. 0.000 0.000 ↓ 0.0

Index Scan using index_custom_field_values_on_event_id_and_custom_field_id on custom_field_values custom_field_values_1820 (cost=0.43..0.48 rows=1 width=35) (actual rows= loops=)

  • Index Cond: ((event_id = events.id) AND (custom_field_id = 1,820))
97.          

SubPlan (for Nested Loop Left Join)

98. 0.000 0.000 ↓ 0.0

Limit (cost=85.68..85.68 rows=1 width=40) (actual rows= loops=)

99. 0.000 0.000 ↓ 0.0

Sort (cost=85.68..85.69 rows=4 width=40) (actual rows= loops=)

  • Sort Key: event_logs.created_at DESC
100. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.72..85.66 rows=4 width=40) (actual rows= loops=)

101. 0.000 0.000 ↓ 0.0

Index Scan using index_event_logs_on_event_id on event_logs (cost=0.44..52.43 rows=4 width=12) (actual rows= loops=)

  • Index Cond: (event_id = events.id)
  • Filter: (to_status = 1)
102. 0.000 0.000 ↓ 0.0

Index Scan using users_pkey on users users_1 (cost=0.29..8.30 rows=1 width=18) (actual rows= loops=)

  • Index Cond: (id = event_logs.user_id)
103. 0.000 0.000 ↓ 0.0

Limit (cost=52.45..52.45 rows=1 width=8) (actual rows= loops=)

104. 0.000 0.000 ↓ 0.0

Sort (cost=52.45..52.46 rows=4 width=8) (actual rows= loops=)

  • Sort Key: event_logs_1.created_at DESC
105. 0.000 0.000 ↓ 0.0

Index Scan using index_event_logs_on_event_id on event_logs event_logs_1 (cost=0.44..52.43 rows=4 width=8) (actual rows= loops=)

  • Index Cond: (event_id = events.id)
  • Filter: (to_status = 1)
106. 0.000 0.000 ↓ 0.0

Limit (cost=52.45..52.45 rows=1 width=8) (actual rows= loops=)

107. 0.000 0.000 ↓ 0.0

Sort (cost=52.45..52.46 rows=4 width=8) (actual rows= loops=)

  • Sort Key: event_logs_2.updated_at DESC
108. 0.000 0.000 ↓ 0.0

Index Scan using index_event_logs_on_event_id on event_logs event_logs_2 (cost=0.44..52.43 rows=4 width=8) (actual rows= loops=)

  • Index Cond: (event_id = events.id)
109. 0.000 0.000 ↓ 0.0

Filter: (to_status = 4) -> Nested Loop Left Join (cost=70,729.17..17,612,224.24 rows=519,246 width=732) (actual rows= loops=)

110. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=70,728.74..17,362,906.18 rows=519,246 width=701) (actual rows= loops=)

111. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=70,728.31..17,113,588.11 rows=519,246 width=670) (actual rows= loops=)

112. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=70,727.89..16,864,270.05 rows=519,246 width=639) (actual rows= loops=)

113. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=70,727.46..16,614,951.99 rows=519,246 width=608) (actual rows= loops=)

114. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=70,727.03..16,365,633.93 rows=519,246 width=577) (actual rows= loops=)

115. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=70,726.74..15,855,729.18 rows=519,246 width=560) (actual rows= loops=)

116. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=70,726.46..12,323,760.29 rows=519,246 width=560) (actual rows= loops=)

117. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=70,726.17..11,813,855.55 rows=519,246 width=543) (actual rows= loops=)

118. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=70,725.88..11,647,086.02 rows=519,246 width=543) (actual rows= loops=)

119. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=70,725.59..11,137,181.28 rows=519,246 width=526) (actual rows= loops=)

120. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=70,725.31..7,605,225.41 rows=519,246 width=526) (actual rows= loops=)

121. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=70,724.88..7,366,395.73 rows=519,246 width=520) (actual rows= loops=)

122. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=70,724.59..7,196,062.44 rows=519,246 width=471) (actual rows= loops=)

123. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=70,724.30..7,025,729.46 rows=519,246 width=422) (actual rows= loops=)

124. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=70,724.01..6,855,396.44 rows=519,246 width=373) (actual rows= loops=)

125. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=70,723.58..2,513,960.96 rows=519,246 width=365) (actual rows= loops=)

126. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=70,723.30..2,360,768.74 rows=519,246 width=365) (actual rows= loops=)

127. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=70,723.02..2,201,942.28 rows=519,246 width=355) (actual rows= loops=)

128. 0.000 0.000 ↓ 0.0

Nested Loop (cost=70,722.73..2,043,116.17 rows=519,246 width=337) (actual rows= loops=)

129. 0.000 0.000 ↓ 0.0

Nested Loop (cost=70,722.44..1,872,783.18 rows=519,246 width=288) (actual rows= loops=)

130. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=70,722.01..1,636,778.57 rows=519,246 width=279) (actual rows= loops=)

  • Filter: ((hlp.service_center_id = ANY ('{2638,2835}'::integer[])) OR (events.assign_to_tenant = 2,786) OR (dispatch_from.id IS NOT NULL) OR (dispatch_to.id IS NOT NULL))
131. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=70,721.72..1,464,436.78 rows=519,246 width=279) (actual rows= loops=)

132. 0.000 0.000 ↓ 0.0

Nested Loop (cost=70,721.42..1,294,691.22 rows=519,246 width=263) (actual rows= loops=)

133. 0.000 0.000 ↓ 0.0

Nested Loop (cost=70,721.13..901,381.62 rows=519,290 width=221) (actual rows= loops=)

134. 0.000 0.000 ↓ 0.0

Merge Join (cost=70,720.85..741,083.35 rows=524,059 width=207) (actual rows= loops=)

  • Merge Cond: (events.id = hlp.id)
135. 0.000 0.000 ↓ 0.0

Index Scan Backward using events_pkey on events (cost=0.43..651,962.20 rows=4,222,694 width=166) (actual rows= loops=)

136. 0.000 0.000 ↓ 0.0

Sort (cost=70,707.54..72,017.69 rows=524,059 width=45) (actual rows= loops=)

  • Sort Key: hlp.id DESC
137. 0.000 0.000 ↓ 0.0

Seq Scan on se_helper hlp (cost=0.00..20,923.59 rows=524,059 width=45) (actual rows= loops=)

138. 0.000 0.000 ↓ 0.0

Index Scan using users_pkey on users (cost=0.29..0.31 rows=1 width=22) (actual rows= loops=)

  • Index Cond: (id = events.created_by_user_id)
139. 0.000 0.000 ↓ 0.0

Index Scan using tenants_pkey on tenants user_tenants (cost=0.29..0.76 rows=1 width=50) (actual rows= loops=)

  • Index Cond: (id = users.tenant_id)
140. 0.000 0.000 ↓ 0.0

Index Scan using index_event_dispatches_on_event_id on event_dispatches dispatch_from (cost=0.29..0.32 rows=1 width=20) (actual rows= loops=)

  • Index Cond: (event_id = events.id)
  • Filter: (service_provider_id = ANY ('{2638,2835}'::integer[]))
141. 0.000 0.000 ↓ 0.0

Index Scan using index_event_dispatches_on_event_id on event_dispatches dispatch_to (cost=0.29..0.32 rows=1 width=16) (actual rows= loops=)

  • Index Cond: (event_id = events.id)
  • Filter: (call_center_id = ANY ('{2638,2835}'::integer[]))
142. 0.000 0.000 ↓ 0.0

Index Scan using equipments_pkey on equipments (cost=0.42..0.45 rows=1 width=13) (actual rows= loops=)

  • Index Cond: (id = events.equipment_id)
143. 0.000 0.000 ↓ 0.0

Index Scan using tenants_pkey on tenants iep_tenants (cost=0.29..0.33 rows=1 width=57) (actual rows= loops=)

  • Index Cond: (id = hlp.ep_tenant_id)
144. 0.000 0.000 ↓ 0.0

Index Scan using users_pkey on users drivers (cost=0.29..0.31 rows=1 width=22) (actual rows= loops=)

  • Index Cond: (id = events.driver_id)
145. 0.000 0.000 ↓ 0.0

Index Scan using users_pkey on users technician (cost=0.29..0.31 rows=1 width=18) (actual rows= loops=)

  • Index Cond: (id = events.assign_to_user)
146. 0.000 0.000 ↓ 0.0

Index Scan using ancillary_locations_pkey on ancillary_locations (cost=0.28..0.30 rows=1 width=8) (actual rows= loops=)

  • Index Cond: (id = events.ancillary_location_id)
147. 0.000 0.000 ↓ 0.0

Index Scan using addresses_pkey on addresses ancillary_location_addresses (cost=0.43..8.36 rows=1 width=16) (actual rows= loops=)

  • Index Cond: (id = ancillary_locations.address_id)
148. 0.000 0.000 ↓ 0.0

Index Scan using tenants_pkey on tenants td_tenants (cost=0.29..0.33 rows=1 width=57) (actual rows= loops=)

  • Index Cond: (id = hlp.td_tenant_id)
  • Filter: (deleted_at IS NULL)
149. 0.000 0.000 ↓ 0.0

Index Scan using tenants_pkey on tenants sp_tenants (cost=0.29..0.33 rows=1 width=57) (actual rows= loops=)

  • Index Cond: (id = hlp.sp_tenant_id)
  • Filter: (deleted_at IS NULL)
150. 0.000 0.000 ↓ 0.0

Index Scan using tenants_pkey on tenants shipper_tenants (cost=0.29..0.33 rows=1 width=57) (actual rows= loops=)

  • Index Cond: (id = hlp.sh_tenant_id)
  • Filter: (deleted_at IS NULL)
151. 0.000 0.000 ↓ 0.0

Index Scan using index_event_grades_on_event_id on event_grades (cost=0.42..0.45 rows=1 width=10) (actual rows= loops=)

  • Index Cond: (event_id = events.id)
152. 0.000 0.000 ↓ 0.0

Index Scan using service_centers_pkey on service_centers from_sc (cost=0.29..6.80 rows=1 width=8) (actual rows= loops=)

  • Index Cond: (id = dispatch_from.call_center_id)
153. 0.000 0.000 ↓ 0.0

Index Scan using tenants_pkey on tenants from_sct (cost=0.29..0.98 rows=1 width=25) (actual rows= loops=)

  • Index Cond: (id = from_sc.tenant_id)
154. 0.000 0.000 ↓ 0.0

Index Scan using service_centers_pkey on service_centers to_sc (cost=0.29..0.32 rows=1 width=8) (actual rows= loops=)

  • Index Cond: (id = dispatch_to.service_provider_id)
155. 0.000 0.000 ↓ 0.0

Index Scan using tenants_pkey on tenants to_sct (cost=0.29..0.98 rows=1 width=25) (actual rows= loops=)

  • Index Cond: (id = to_sc.tenant_id)
156. 0.000 0.000 ↓ 0.0

Index Scan using service_centers_pkey on service_centers to_child_sc (cost=0.29..6.80 rows=1 width=8) (actual rows= loops=)

  • Index Cond: (id = dispatch_from.service_provider_id)
157. 0.000 0.000 ↓ 0.0

Index Scan using tenants_pkey on tenants to_child_sct (cost=0.29..0.98 rows=1 width=25) (actual rows= loops=)

  • Index Cond: (id = to_child_sc.tenant_id)
158. 0.000 0.000 ↓ 0.0

Index Scan using index_custom_field_values_on_event_id_and_custom_field_id on custom_field_values custom_field_values_210 (cost=0.43..0.48 rows=1 width=35) (actual rows= loops=)

  • Index Cond: ((event_id = events.id) AND (custom_field_id = 210))
159. 0.000 0.000 ↓ 0.0

Index Scan using index_custom_field_values_on_event_id_and_custom_field_id on custom_field_values custom_field_values_211 (cost=0.43..0.48 rows=1 width=35) (actual rows= loops=)

  • Index Cond: ((event_id = events.id) AND (custom_field_id = 211))
160. 0.000 0.000 ↓ 0.0

Index Scan using index_custom_field_values_on_event_id_and_custom_field_id on custom_field_values custom_field_values_212 (cost=0.43..0.48 rows=1 width=35) (actual rows= loops=)

  • Index Cond: ((event_id = events.id) AND (custom_field_id = 212))
161. 0.000 0.000 ↓ 0.0

Index Scan using index_custom_field_values_on_event_id_and_custom_field_id on custom_field_values custom_field_values_217 (cost=0.43..0.48 rows=1 width=35) (actual rows= loops=)

  • Index Cond: ((event_id = events.id) AND (custom_field_id = 217))
162. 0.000 0.000 ↓ 0.0

Index Scan using index_custom_field_values_on_event_id_and_custom_field_id on custom_field_values custom_field_values_218 (cost=0.43..0.48 rows=1 width=35) (actual rows= loops=)

  • Index Cond: ((event_id = events.id) AND (custom_field_id = 218))
163. 0.000 0.000 ↓ 0.0

Index Scan using index_custom_field_values_on_event_id_and_custom_field_id on custom_field_values custom_field_values_219 (cost=0.43..0.48 rows=1 width=35) (actual rows= loops=)

  • Index Cond: ((event_id = events.id) AND (custom_field_id = 219))
164. 0.000 0.000 ↓ 0.0

Index Scan using index_custom_field_values_on_event_id_and_custom_field_id on custom_field_values custom_field_values_220 (cost=0.43..0.48 rows=1 width=35) (actual rows= loops=)

  • Index Cond: ((event_id = events.id) AND (custom_field_id = 220))
165. 0.000 0.000 ↓ 0.0

Index Scan using index_custom_field_values_on_event_id_and_custom_field_id on custom_field_values custom_field_values_221 (cost=0.43..0.48 rows=1 width=35) (actual rows= loops=)

  • Index Cond: ((event_id = events.id) AND (custom_field_id = 221))
166. 0.000 0.000 ↓ 0.0

Index Scan using index_custom_field_values_on_event_id_and_custom_field_id on custom_field_values custom_field_values_222 (cost=0.43..0.48 rows=1 width=35) (actual rows= loops=)

  • Index Cond: ((event_id = events.id) AND (custom_field_id = 222))
167. 0.000 0.000 ↓ 0.0

Index Scan using index_custom_field_values_on_event_id_and_custom_field_id on custom_field_values custom_field_values_223 (cost=0.43..0.48 rows=1 width=35) (actual rows= loops=)

  • Index Cond: ((event_id = events.id) AND (custom_field_id = 223))
168. 0.000 0.000 ↓ 0.0

Index Scan using index_custom_field_values_on_event_id_and_custom_field_id on custom_field_values custom_field_values_253 (cost=0.43..0.48 rows=1 width=35) (actual rows= loops=)

  • Index Cond: ((event_id = events.id) AND (custom_field_id = 253))
169. 0.000 0.000 ↓ 0.0

Index Scan using index_custom_field_values_on_event_id_and_custom_field_id on custom_field_values custom_field_values_260 (cost=0.43..0.48 rows=1 width=35) (actual rows= loops=)

  • Index Cond: ((event_id = events.id) AND (custom_field_id = 260))
170. 0.000 0.000 ↓ 0.0

Index Scan using index_custom_field_values_on_event_id_and_custom_field_id on custom_field_values custom_field_values_277 (cost=0.43..0.48 rows=1 width=35) (actual rows= loops=)

  • Index Cond: ((event_id = events.id) AND (custom_field_id = 277))
171. 0.000 0.000 ↓ 0.0

Index Scan using index_custom_field_values_on_event_id_and_custom_field_id on custom_field_values custom_field_values_278 (cost=0.43..0.48 rows=1 width=35) (actual rows= loops=)

  • Index Cond: ((event_id = events.id) AND (custom_field_id = 278))
172. 0.000 0.000 ↓ 0.0

Index Scan using index_custom_field_values_on_event_id_and_custom_field_id on custom_field_values custom_field_values_538 (cost=0.43..0.48 rows=1 width=35) (actual rows= loops=)

  • Index Cond: ((event_id = events.id) AND (custom_field_id = 538))
173. 0.000 0.000 ↓ 0.0

Index Scan using index_custom_field_values_on_event_id_and_custom_field_id on custom_field_values custom_field_values_539 (cost=0.43..0.48 rows=1 width=35) (actual rows= loops=)

  • Index Cond: ((event_id = events.id) AND (custom_field_id = 539))
174. 0.000 0.000 ↓ 0.0

Index Scan using index_custom_field_values_on_event_id_and_custom_field_id on custom_field_values custom_field_values_1782 (cost=0.43..0.48 rows=1 width=35) (actual rows= loops=)

  • Index Cond: ((event_id = events.id) AND (custom_field_id = 1,782))
175. 0.000 0.000 ↓ 0.0

Limit (cost=85.68..85.68 rows=1 width=40) (actual rows= loops=)

176. 0.000 0.000 ↓ 0.0

Sort (cost=85.68..85.69 rows=4 width=40) (actual rows= loops=)

  • Sort Key: event_logs.created_at DESC
177. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.72..85.66 rows=4 width=40) (actual rows= loops=)

178. 0.000 0.000 ↓ 0.0

Index Scan using index_event_logs_on_event_id on event_logs (cost=0.44..52.43 rows=4 width=12) (actual rows= loops=)

  • Index Cond: (event_id = events.id)
  • Filter: (to_status = 1)
179. 0.000 0.000 ↓ 0.0

Index Scan using users_pkey on users users_1 (cost=0.29..8.30 rows=1 width=18) (actual rows= loops=)

  • Index Cond: (id = event_logs.user_id)
180. 0.000 0.000 ↓ 0.0

Limit (cost=52.45..52.45 rows=1 width=8) (actual rows= loops=)

181. 0.000 0.000 ↓ 0.0

Sort (cost=52.45..52.46 rows=4 width=8) (actual rows= loops=)

  • Sort Key: event_logs_1.created_at DESC
182. 0.000 0.000 ↓ 0.0

Index Scan using index_event_logs_on_event_id on event_logs event_logs_1 (cost=0.44..52.43 rows=4 width=8) (actual rows= loops=)

  • Index Cond: (event_id = events.id)
  • Filter: (to_status = 1)
183. 0.000 0.000 ↓ 0.0

Limit (cost=52.45..52.45 rows=1 width=8) (actual rows= loops=)

184. 0.000 0.000 ↓ 0.0

Sort (cost=52.45..52.46 rows=4 width=8) (actual rows= loops=)

  • Sort Key: event_logs_2.updated_at DESC
185. 0.000 0.000 ↓ 0.0

Index Scan using index_event_logs_on_event_id on event_logs event_logs_2 (cost=0.44..52.43 rows=4 width=8) (actual rows= loops=)

  • Index Cond: (event_id = events.id)
  • Filter: (to_status = 4)