explain.depesz.com

PostgreSQL's explain analyze made readable

Result: giuB

Settings
# exclusive inclusive rows x rows loops node
1. 0.127 1,619.380 ↑ 3.8 11 1

Sort (cost=30,964.12..30,964.22 rows=42 width=2,041) (actual time=1,619.377..1,619.380 rows=11 loops=1)

  • Sort Key: ((SubPlan 15)), r.""order"
  • Sort Method: quicksort Memory: 41kB
2.          

CTE meta_routes

3. 464.143 543.945 ↓ 6.8 846 1

Hash Left Join (cost=426.12..3,566.48 rows=125 width=68) (actual time=9.864..543.945 rows=846 loops=1)

  • Hash Cond: ((r_1.trailer_model_id)::integer = (tm.id)::integer)
4.          

Initplan (for Hash Left Join)

5. 0.005 2.866 ↑ 1.0 1 1

Aggregate (cost=422.66..422.67 rows=1 width=4) (actual time=2.866..2.866 rows=1 loops=1)

6.          

Initplan (for Aggregate)

7. 0.011 0.011 ↑ 1.0 1 1

Index Scan using deliveries_cars_tasks_pkey on deliveries_cars_tasks (cost=0.29..8.31 rows=1 width=4) (actual time=0.011..0.011 rows=1 loops=1)

  • Index Cond: ((id)::integer = 94,533)
8. 0.009 0.009 ↑ 1.0 1 1

Index Scan using delivery_pkey on deliveries (cost=0.29..8.30 rows=1 width=8) (actual time=0.009..0.009 rows=1 loops=1)

  • Index Cond: ((id)::integer = 227,786)
9. 2.841 2.841 ↑ 144.8 49 1

Seq Scan on deliveries deliveries_1 (cost=0.00..388.31 rows=7,094 width=4) (actual time=0.061..2.841 rows=49 loops=1)

  • Filter: CASE WHEN (NOT COALESCE((($3)::integer = 3), true)) THEN (((datetime)::timestamp without time zone = ($4)::timestamp without time zone) AND accepted) ELSE ((id)::integer = 227,786) END
  • Rows Removed by Filter: 14,140
10. 0.767 6.691 ↓ 6.8 846 1

Hash Left Join (cost=2.19..553.90 rows=125 width=67) (actual time=3.014..6.691 rows=846 loops=1)

  • Hash Cond: ((r_1.car_model_id)::integer = (cm.id)::integer)
11. 1.315 5.905 ↓ 6.8 846 1

Nested Loop (cost=0.71..550.77 rows=125 width=67) (actual time=2.970..5.905 rows=846 loops=1)

12. 2.973 2.973 ↓ 4.9 49 1

Index Scan using delivery_pkey on deliveries d (cost=0.29..47.44 rows=10 width=8) (actual time=2.883..2.973 rows=49 loops=1)

  • Index Cond: ((id)::integer = ANY ($5))
13. 1.617 1.617 ↓ 1.3 17 49

Index Scan using routes_delivery_id_for_transits_idx on routes r_1 (cost=0.43..50.20 rows=13 width=63) (actual time=0.003..0.033 rows=17 loops=49)

  • Index Cond: ((delivery_id)::integer = (d.id)::integer)
14. 0.009 0.019 ↑ 1.0 21 1

Hash (cost=1.21..1.21 rows=21 width=8) (actual time=0.019..0.019 rows=21 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
15. 0.010 0.010 ↑ 1.0 21 1

Seq Scan on cars_models cm (cost=0.00..1.21 rows=21 width=8) (actual time=0.005..0.010 rows=21 loops=1)

16. 0.013 0.017 ↑ 1.0 12 1

Hash (cost=1.12..1.12 rows=12 width=9) (actual time=0.017..0.017 rows=12 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
17. 0.004 0.004 ↑ 1.0 12 1

Seq Scan on trailers_models tm (cost=0.00..1.12 rows=12 width=9) (actual time=0.003..0.004 rows=12 loops=1)

18.          

SubPlan (for Hash Left Join)

19. 2.538 70.218 ↑ 1.0 1 846

Aggregate (cost=11.48..11.49 rows=1 width=26) (actual time=0.083..0.083 rows=1 loops=846)

20. 67.680 67.680 ↓ 0.0 0 846

Seq Scan on distribution_centers dc_1 (cost=0.00..11.45 rows=10 width=26) (actual time=0.039..0.080 rows=0 loops=846)

  • Filter: ((id)::integer = ANY ((string_to_array(r_1.directions_dc_id, ','::text))::integer[]))
  • Rows Removed by Filter: 115
21. 0.000 0.000 ↓ 0.0 0

Index Only Scan using open_routes_change_sessions_route_state on open_routes_change_sessions orcs (cost=0.42..8.45 rows=1 width=0) (never executed)

  • Index Cond: ((state = 0) AND (route_id = (r_1.id)::integer))
  • Heap Fetches: 0
22. 0.010 0.010 ↓ 0.0 0 1

Index Only Scan using open_routes_change_sessions_route_state on open_routes_change_sessions orcs_1 (cost=0.42..8.44 rows=1 width=4) (actual time=0.010..0.010 rows=0 loops=1)

  • Index Cond: (state = 0)
  • Heap Fetches: 0
23.          

CTE markets_points

24. 0.001 7.203 ↓ 0.0 0 1

WindowAgg (cost=1,201.37..1,201.75 rows=15 width=58) (actual time=7.203..7.203 rows=0 loops=1)

25. 0.009 7.202 ↓ 0.0 0 1

Sort (cost=1,201.37..1,201.41 rows=15 width=58) (actual time=7.202..7.202 rows=0 loops=1)

  • Sort Key: rpa.route_id, ((rpa.sched_begin_time IS NOT NULL)) DESC, rpa.order_num DESC
  • Sort Method: quicksort Memory: 25kB
26. 0.177 7.193 ↓ 0.0 0 1

Nested Loop (cost=3.68..1,201.08 rows=15 width=58) (actual time=7.193..7.193 rows=0 loops=1)

27. 0.658 3.632 ↓ 6.8 846 1

Nested Loop (cost=3.25..1,061.56 rows=125 width=13) (actual time=0.331..3.632 rows=846 loops=1)

28. 0.307 0.436 ↓ 6.8 846 1

HashAggregate (cost=2.81..4.06 rows=125 width=4) (actual time=0.316..0.436 rows=846 loops=1)

  • Group Key: (mmr.route_id)::integer
29. 0.129 0.129 ↓ 6.8 846 1

CTE Scan on meta_routes mmr (cost=0.00..2.50 rows=125 width=4) (actual time=0.002..0.129 rows=846 loops=1)

30. 2.538 2.538 ↑ 1.0 1 846

Index Scan using routes_pkey on routes r_2 (cost=0.43..8.45 rows=1 width=9) (actual time=0.003..0.003 rows=1 loops=846)

  • Index Cond: ((id)::integer = (mmr.route_id)::integer)
31. 3.384 3.384 ↓ 0.0 0 846

Index Scan using routes_points_all_idx2 on routes_points_all rpa (cost=0.43..1.11 rows=1 width=63) (actual time=0.004..0.004 rows=0 loops=846)

  • Index Cond: ((route_id)::integer = (r_2.id)::integer)
  • Filter: (((type_id)::integer = ANY ('{1,2}'::integer[])) AND (object_type = 'market'::text) AND (COALESCE(r_2.opened, false) = COALESCE(open_route_point, false)) AND CASE WHEN (r_2.routes_type_transits IS NOT NULL) THEN ((type_id)::integer = ANY ('{3,4}'::integer[])) WHEN (r_2.routes_type = 0) THEN ((type_id)::integer = ANY ('{1,4}'::integer[])) WHEN (r_2.routes_type = 1) THEN ((type_id)::integer = ANY ('{2,4}'::integer[])) ELSE false END)
  • Rows Removed by Filter: 2
32.          

CTE unvisited_points

33. 0.000 0.000 ↓ 0.0 0

HashAggregate (cost=0.31..0.32 rows=1 width=20) (never executed)

  • Group Key: mp.route_id
34. 0.000 0.000 ↓ 0.0 0

CTE Scan on markets_points mp (cost=0.00..0.30 rows=1 width=20) (never executed)

  • Filter: (gps_arrival_time IS NULL)
35.          

CTE last_market

36. 0.002 7.214 ↓ 0.0 0 1

HashAggregate (cost=1.07..1.22 rows=15 width=55) (actual time=7.214..7.214 rows=0 loops=1)

  • Group Key: mp_1.route_id, first_value(mp_1.settle_name) OVER (?)
37. 0.000 7.212 ↓ 0.0 0 1

WindowAgg (cost=0.69..0.99 rows=15 width=55) (actual time=7.212..7.212 rows=0 loops=1)

38. 0.007 7.212 ↓ 0.0 0 1

Sort (cost=0.69..0.73 rows=15 width=55) (actual time=7.212..7.212 rows=0 loops=1)

  • Sort Key: mp_1.route_id, (CASE WHEN (mp_1.last_sched_cheked AND (up.has_main IS NOT TRUE) AND (up.has_sub IS NOT TRUE)) THEN mp_1.gps_arrival_time ELSE mp_1.arrival_time END) DESC NULLS LAST
  • Sort Method: quicksort Memory: 25kB
39. 0.001 7.205 ↓ 0.0 0 1

Hash Left Join (cost=0.03..0.40 rows=15 width=55) (actual time=7.205..7.205 rows=0 loops=1)

  • Hash Cond: ((mp_1.route_id)::integer = (up.route_id)::integer)
40. 7.204 7.204 ↓ 0.0 0 1

CTE Scan on markets_points mp_1 (cost=0.00..0.30 rows=15 width=53) (actual time=7.204..7.204 rows=0 loops=1)

41. 0.000 0.000 ↓ 0.0 0

Hash (cost=0.02..0.02 rows=1 width=6) (never executed)

42. 0.000 0.000 ↓ 0.0 0

CTE Scan on unvisited_points up (cost=0.00..0.02 rows=1 width=6) (never executed)

43.          

CTE meta_routes_drivers

44. 0.456 7.970 ↓ 4.9 836 1

HashAggregate (cost=4,010.21..4,011.92 rows=171 width=73) (actual time=7.854..7.970 rows=836 loops=1)

  • Group Key: rd.route_id, (string_agg(concat_ws(' '::text, rd.sname, rd.name, rd.pname), ', '::text ORDER BY rd.id)), (string_agg((COALESCE((rd.phones)::character varying, ''::character varying))::text, ', '::text ORDER BY rd.id))
45. 0.065 7.514 ↓ 4.9 836 1

Append (cost=641.50..4,008.93 rows=171 width=73) (actual time=0.911..7.514 rows=836 loops=1)

46. 0.778 1.689 ↓ 1.9 209 1

GroupAggregate (cost=641.50..644.50 rows=109 width=74) (actual time=0.911..1.689 rows=209 loops=1)

  • Group Key: rd.route_id
47. 0.097 0.911 ↓ 1.9 209 1

Sort (cost=641.50..641.77 rows=109 width=74) (actual time=0.893..0.911 rows=209 loops=1)

  • Sort Key: rd.route_id
  • Sort Method: quicksort Memory: 54kB
48. 0.047 0.814 ↓ 1.9 209 1

Nested Loop (cost=0.43..637.81 rows=109 width=74) (actual time=0.012..0.814 rows=209 loops=1)

49. 0.110 0.110 ↓ 3.5 219 1

CTE Scan on meta_routes mr2 (cost=0.00..2.50 rows=62 width=4) (actual time=0.002..0.110 rows=219 loops=1)

  • Filter: (opened IS NOT TRUE)
  • Rows Removed by Filter: 627
50. 0.657 0.657 ↑ 2.0 1 219

Index Scan using routes_drivers_idx on routes_drivers rd (cost=0.43..10.23 rows=2 width=74) (actual time=0.003..0.003 rows=1 loops=219)

  • Index Cond: ((route_id)::integer = (mr2.route_id)::integer)
51. 2.196 5.760 ↓ 10.1 627 1

GroupAggregate (cost=3,354.04..3,362.72 rows=62 width=72) (actual time=3.498..5.760 rows=627 loops=1)

  • Group Key: mr3.route_id
52. 0.324 3.564 ↓ 1.0 627 1

Sort (cost=3,354.04..3,355.59 rows=620 width=72) (actual time=3.481..3.564 rows=627 loops=1)

  • Sort Key: mr3.route_id
  • Sort Method: quicksort Memory: 113kB
53. 0.559 3.240 ↓ 1.0 627 1

Nested Loop (cost=0.42..3,325.29 rows=620 width=72) (actual time=0.017..3.240 rows=627 loops=1)

54. 0.173 0.173 ↓ 10.1 627 1

CTE Scan on meta_routes mr3 (cost=0.00..2.50 rows=62 width=36) (actual time=0.001..0.173 rows=627 loops=1)

  • Filter: (opened IS TRUE)
  • Rows Removed by Filter: 219
55. 2.508 2.508 ↑ 10.0 1 627

Index Scan using drivers_pkey1 on drivers d_1 (cost=0.42..53.49 rows=10 width=68) (actual time=0.004..0.004 rows=1 loops=627)

  • Index Cond: ((id)::integer = ANY (mr3.current_drivers_id))
56.          

Initplan (for Sort)

57. 0.005 0.005 ↑ 1.0 1 1

Seq Scan on auto_open_route_types (cost=0.00..1.02 rows=1 width=4) (actual time=0.005..0.005 rows=1 loops=1)

  • Filter: ((code)::text = 'future_auto_open'::text)
  • Rows Removed by Filter: 1
58. 4.199 1,619.248 ↑ 3.8 11 1

Hash Left Join (cost=15,363.15..22,180.27 rows=42 width=2,041) (actual time=868.827..1,619.248 rows=11 loops=1)

  • Hash Cond: (r.scheme_id = rs.id)
59. 0.012 1,610.599 ↑ 3.8 11 1

Nested Loop Left Join (cost=15,362.08..18,178.84 rows=42 width=2,032) (actual time=864.560..1,610.599 rows=11 loops=1)

60. 1.764 1,610.565 ↑ 3.8 11 1

Nested Loop Left Join (cost=15,361.80..18,165.82 rows=42 width=1,972) (actual time=864.551..1,610.565 rows=11 loops=1)

  • Filter: CASE WHEN mr.is_transit THEN CASE WHEN COALESCE(dct.formed, false) THEN (((r.deliveries_cars_tasks_id)::integer = (dct.id)::integer) OR ((COALESCE((r.functional)::integer, '-1'::integer) = ANY (dctt.functional_ext)) AND (r.functional_transferred IS NULL)) OR (COALESCE((r.functional_transferred)::integer, '-1'::integer) = ANY (dctt.functional_transferred_ext))) ELSE CASE WHEN (((dctt.id)::integer <> 4) AND (r.functional_transferred IS NULL) AND (r.functional IS NULL)) THEN (dctt.default_car_type_delivery = COALESCE((c.type_delivery)::integer, '-1'::integer)) ELSE CASE WHEN (r.functional_transferred IS NULL) THEN (COALESCE((r.functional)::integer, '-1'::integer) = ANY (dctt.functional_ext)) ELSE (r.functional_transferred = ANY (dctt.functional_transferred_ext)) END END END ELSE true END
  • Rows Removed by Filter: 835
61. 0.731 1,608.801 ↓ 10.0 846 1

Nested Loop Left Join (cost=15,361.51..18,149.83 rows=85 width=1,979) (actual time=864.523..1,608.801 rows=846 loops=1)

62. 1.219 1,606.378 ↓ 10.0 846 1

Nested Loop Left Join (cost=15,361.09..18,111.62 rows=85 width=1,916) (actual time=864.513..1,606.378 rows=846 loops=1)

  • Join Filter: mr.is_transit
63. 0.904 1,603.467 ↓ 10.0 846 1

Hash Left Join (cost=15,360.67..18,073.36 rows=85 width=1,845) (actual time=864.498..1,603.467 rows=846 loops=1)

  • Hash Cond: ((r.route_acception_status = ras.id) AND (COALESCE(r.general_route_acception, false) = ras.accepted))
  • Join Filter: (r.opened IS TRUE)
64. 0.813 1,602.553 ↓ 10.0 846 1

Hash Left Join (cost=15,359.47..18,071.51 rows=85 width=1,801) (actual time=864.477..1,602.553 rows=846 loops=1)

  • Hash Cond: ((r.delivery_acception_status = das.id) AND (r.general_delivery_acception = das.accepted))
65. 1.144 1,601.727 ↓ 10.0 846 1

Hash Left Join (cost=15,358.24..18,069.64 rows=85 width=1,758) (actual time=864.454..1,601.727 rows=846 loops=1)

  • Hash Cond: ((r.id)::integer = (mrd.route_id)::integer)
66. 0.972 1,592.122 ↓ 10.0 846 1

Nested Loop Left Join (cost=15,352.69..18,063.75 rows=85 width=1,694) (actual time=855.985..1,592.122 rows=846 loops=1)

67. 1.502 1,586.920 ↓ 10.0 846 1

Nested Loop Left Join (cost=15,352.25..17,187.42 rows=85 width=1,622) (actual time=855.962..1,586.920 rows=846 loops=1)

  • Join Filter: (NOT mr.is_transit)
  • Rows Removed by Join Filter: 846
68. 0.558 862.934 ↓ 10.0 846 1

Hash Left Join (cost=15,341.75..17,175.22 rows=85 width=1,462) (actual time=852.884..862.934 rows=846 loops=1)

  • Hash Cond: ((mr.route_id)::integer = (lm.route_id)::integer)
  • Join Filter: (NOT mr.is_transit)
69. 0.503 855.159 ↓ 10.0 846 1

Hash Left Join (cost=15,341.26..17,174.31 rows=85 width=1,434) (actual time=845.657..855.159 rows=846 loops=1)

  • Hash Cond: (cch.comment_template = cct.id)
70. 1.065 854.636 ↓ 10.0 846 1

Nested Loop Left Join (cost=15,339.34..17,171.52 rows=85 width=1,412) (actual time=845.626..854.636 rows=846 loops=1)

71. 0.719 851.033 ↓ 10.0 846 1

Nested Loop Left Join (cost=15,338.91..17,132.63 rows=85 width=1,395) (actual time=845.615..851.033 rows=846 loops=1)

72. 0.745 850.314 ↓ 10.0 846 1

Nested Loop Left Join (cost=15,338.77..17,117.75 rows=85 width=1,394) (actual time=845.611..850.314 rows=846 loops=1)

73. 0.721 849.569 ↓ 10.0 846 1

Nested Loop Left Join (cost=15,338.49..17,091.82 rows=85 width=1,356) (actual time=845.606..849.569 rows=846 loops=1)

74. 0.536 848.848 ↓ 10.0 846 1

Hash Left Join (cost=15,338.21..16,953.52 rows=85 width=1,310) (actual time=845.601..848.848 rows=846 loops=1)

  • Hash Cond: ((prikom_ak.autocades_managers_id)::integer = (am_prikom.id)::integer)
75. 0.854 848.202 ↓ 10.0 846 1

Nested Loop Left Join (cost=15,325.66..16,940.38 rows=85 width=1,310) (actual time=845.478..848.202 rows=846 loops=1)

76. 11.925 847.348 ↓ 10.0 846 1

Hash Right Join (cost=15,325.51..16,925.46 rows=85 width=1,310) (actual time=845.473..847.348 rows=846 loops=1)

  • Hash Cond: (cch.route_id = (r.id)::integer)
77. 3.668 3.668 ↑ 1.0 46,759 1

Seq Scan on car_comments_history cch (cost=0.00..1,424.59 rows=46,759 width=72) (actual time=0.002..3.668 rows=46,759 loops=1)

78. 2.392 831.755 ↓ 10.0 846 1

Hash (cost=15,324.45..15,324.45 rows=85 width=1,242) (actual time=831.755..831.755 rows=846 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 672kB
79. 0.705 829.363 ↓ 10.0 846 1

Nested Loop Left Join (cost=13,153.24..15,324.45 rows=85 width=1,242) (actual time=784.941..829.363 rows=846 loops=1)

80. 0.773 826.966 ↓ 10.0 846 1

Hash Left Join (cost=13,152.96..15,186.15 rows=85 width=1,196) (actual time=784.936..826.966 rows=846 loops=1)

  • Hash Cond: ((r.responsible_dc_id)::integer = (dc.id)::integer)
81. 0.512 826.139 ↓ 10.0 846 1

Nested Loop Left Join (cost=13,142.38..15,175.07 rows=85 width=1,174) (actual time=784.868..826.139 rows=846 loops=1)

82. 1.018 822.243 ↓ 10.0 846 1

Nested Loop Left Join (cost=13,141.94..15,128.98 rows=85 width=1,150) (actual time=784.853..822.243 rows=846 loops=1)

83. 0.820 819.533 ↓ 10.0 846 1

Hash Left Join (cost=13,141.66..15,102.14 rows=85 width=1,150) (actual time=784.839..819.533 rows=846 loops=1)

  • Hash Cond: ((COALESCE(r.opened, false) = frs.is_opened) AND (r.auto_open = frs.is_auto_open) AND ((haor.auto_open_route_id IS NOT NULL) = frs.has_future_route) AND (COALESCE(ref.status_future_route_opened, '-1'::integer) = frs.open_type))
84. 1.269 818.704 ↓ 10.0 846 1

Hash Left Join (cost=13,140.42..15,099.19 rows=85 width=1,157) (actual time=784.815..818.704 rows=846 loops=1)

  • Hash Cond: ((COALESCE(r.opened, false) = ors.is_opened) AND (ref.auto_open_rc = ors.is_auto_open) AND (COALESCE((r.route_status = 1), false) = ors.is_finished) AND (COALESCE((r.open_type)::integer, '-1'::integer) = ors.open_type))
85. 0.609 817.423 ↓ 10.0 846 1

Hash Left Join (cost=13,139.03..15,094.39 rows=85 width=1,160) (actual time=784.781..817.423 rows=846 loops=1)

  • Hash Cond: ((r.id)::integer = (haor.route_id)::integer)
86. 0.684 816.699 ↓ 10.0 846 1

Nested Loop Left Join (cost=13,127.10..15,082.03 rows=85 width=1,156) (actual time=784.655..816.699 rows=846 loops=1)

87. 1.136 813.477 ↓ 10.0 846 1

Nested Loop Left Join (cost=13,118.65..13,732.91 rows=85 width=1,144) (actual time=784.640..813.477 rows=846 loops=1)

88. 0.512 810.649 ↓ 10.0 846 1

Hash Left Join (cost=13,118.37..13,706.55 rows=85 width=1,122) (actual time=784.627..810.649 rows=846 loops=1)

  • Hash Cond: ((vr.route_cause_id)::integer = (de_erc.id)::integer)
89. 0.567 810.129 ↓ 10.0 846 1

Hash Left Join (cost=13,117.30..13,705.15 rows=85 width=1,085) (actual time=784.608..810.129 rows=846 loops=1)

  • Hash Cond: ((vr.delivery_cause_id)::integer = (de_ercd.id)::integer)
90. 1.124 809.549 ↓ 10.0 846 1

Nested Loop Left Join (cost=13,116.21..13,703.72 rows=85 width=1,057) (actual time=784.585..809.549 rows=846 loops=1)

91. 1.123 805.887 ↓ 10.0 846 1

Nested Loop Left Join (cost=13,115.78..13,658.55 rows=85 width=1,046) (actual time=784.572..805.887 rows=846 loops=1)

92. 0.584 802.226 ↓ 10.0 846 1

Nested Loop Left Join (cost=13,115.34..13,612.05 rows=85 width=1,025) (actual time=784.555..802.226 rows=846 loops=1)

93. 0.901 790.644 ↓ 10.0 846 1

Hash Left Join (cost=13,114.23..13,504.63 rows=85 width=961) (actual time=784.499..790.644 rows=846 loops=1)

  • Hash Cond: (((CASE WHEN ((cs.state_car)::integer = 12) THEN 12 WHEN ((ts.state_trailer)::integer = 12) THEN 34 WHEN ((cs.state_car)::integer = 33) THEN 33 WHEN ((ts.state_trailer)::integer = 33) THEN 35 ELSE (cs.state_car)::integer END)::identifier)::integer = (vst2.id)::integer)
94. 0.336 789.727 ↓ 10.0 846 1

Nested Loop (cost=13,112.42..13,501.93 rows=85 width=965) (actual time=784.462..789.727 rows=846 loops=1)

95. 0.005 0.013 ↑ 1.0 1 1

Aggregate (cost=1.36..1.37 rows=1 width=0) (actual time=0.012..0.013 rows=1 loops=1)

96. 0.008 0.008 ↑ 1.0 36 1

Seq Scan on vehicles_statuses_types vst (cost=0.00..1.36 rows=36 width=0) (actual time=0.005..0.008 rows=36 loops=1)

97. 3.341 789.378 ↓ 10.0 846 1

Hash Right Join (cost=13,111.06..13,499.70 rows=85 width=965) (actual time=784.445..789.378 rows=846 loops=1)

  • Hash Cond: ((ts.trailer_id)::integer = (c.trailer_id)::integer)
98. 1.637 1.637 ↑ 1.0 19,960 1

Seq Scan on trailers_statuses ts (cost=0.00..313.60 rows=19,960 width=8) (actual time=0.007..1.637 rows=19,960 loops=1)

99. 1.793 784.400 ↓ 10.0 846 1

Hash (cost=13,109.99..13,109.99 rows=85 width=965) (actual time=784.400..784.400 rows=846 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 563kB
100. 8.089 782.607 ↓ 10.0 846 1

Hash Join (cost=4,819.10..13,109.99 rows=85 width=965) (actual time=591.180..782.607 rows=846 loops=1)

  • Hash Cond: ((c.id)::integer = (cs.car_id)::integer)
101. 13.642 214.199 ↑ 1.0 60,468 1

Hash Left Join (cost=3,717.47..11,780.75 rows=60,468 width=268) (actual time=30.828..214.199 rows=60,468 loops=1)

  • Hash Cond: ((c.gps_device_id)::integer = (rusc.gps_device_id)::integer)
102. 17.020 197.965 ↑ 1.0 60,468 1

Hash Left Join (cost=3,293.55..11,080.41 rows=60,468 width=262) (actual time=28.208..197.965 rows=60,468 loops=1)

  • Hash Cond: ((c.warm_type_id)::integer = (wt_c.id)::integer)
103. 12.213 180.939 ↑ 1.0 60,468 1

Hash Left Join (cost=3,292.42..10,247.84 rows=60,468 width=255) (actual time=28.192..180.939 rows=60,468 loops=1)

  • Hash Cond: (c.temperature_sensor_model_id = tsm_c.id)
104. 11.155 168.713 ↑ 1.0 60,468 1

Hash Left Join (cost=3,290.90..10,003.55 rows=60,468 width=240) (actual time=28.171..168.713 rows=60,468 loops=1)

  • Hash Cond: ((c.receiver_autocade_id)::integer = (tr_a.id)::integer)
105. 11.050 157.456 ↑ 1.0 60,468 1

Hash Left Join (cost=3,274.99..9,760.83 rows=60,468 width=235) (actual time=28.060..157.456 rows=60,468 loops=1)

  • Hash Cond: ((c.receiver_owner_id)::integer = (tr_cto.id)::integer)
106. 11.574 146.012 ↑ 1.0 60,468 1

Hash Left Join (cost=3,199.41..9,457.65 rows=60,468 width=197) (actual time=27.653..146.012 rows=60,468 loops=1)

  • Hash Cond: ((c.autocades_id)::integer = (a.id)::integer)
107. 17.416 134.126 ↑ 1.0 60,468 1

Hash Left Join (cost=3,168.19..9,153.57 rows=60,468 width=192) (actual time=27.334..134.126 rows=60,468 loops=1)

  • Hash Cond: ((c.company_owner_id)::integer = (c_cto.id)::integer)
108. 13.156 116.329 ↑ 1.0 60,468 1

Hash Left Join (cost=3,092.60..8,246.55 rows=60,468 width=196) (actual time=26.946..116.329 rows=60,468 loops=1)

  • Hash Cond: ((c.car_trailer_brand_id)::integer = ctb_c.id)
109. 13.529 103.095 ↑ 1.0 60,468 1

Hash Left Join (cost=3,084.82..7,784.57 rows=60,468 width=172) (actual time=26.862..103.095 rows=60,468 loops=1)

  • Hash Cond: ((c.id)::integer = (cg.car_id)::integer)
110. 15.386 84.529 ↑ 1.0 60,468 1

Hash Left Join (cost=2,290.42..6,675.02 rows=60,468 width=148) (actual time=21.775..84.529 rows=60,468 loops=1)

  • Hash Cond: ((c.type_delivery)::integer = dtt.id)
111. 17.907 69.135 ↑ 1.0 60,468 1

Hash Left Join (cost=2,289.27..5,842.43 rows=60,468 width=131) (actual time=21.756..69.135 rows=60,468 loops=1)

  • Hash Cond: ((c.phone_id)::integer = (ph.id)::integer)
112. 29.489 29.489 ↑ 1.0 60,468 1

Seq Scan on cars c (cost=0.00..3,292.99 rows=60,468 width=123) (actual time=0.006..29.489 rows=60,468 loops=1)

  • Filter: (NOT archive)
  • Rows Removed by Filter: 28,131
113. 1.729 21.739 ↑ 1.0 11,244 1

Hash (cost=2,148.72..2,148.72 rows=11,244 width=16) (actual time=21.739..21.739 rows=11,244 loops=1)

  • Buckets: 16,384 Batches: 1 Memory Usage: 647kB
114. 1.985 20.010 ↑ 1.0 11,244 1

Hash Left Join (cost=1,321.75..2,148.72 rows=11,244 width=16) (actual time=10.893..20.010 rows=11,244 loops=1)

  • Hash Cond: ((ph.simcard_abroad_id)::integer = (sim_abroad.id)::integer)
115. 4.955 10.383 ↑ 1.0 11,244 1

Hash Right Join (cost=362.99..1,146.73 rows=11,244 width=20) (actual time=3.213..10.383 rows=11,244 loops=1)

  • Hash Cond: ((sim.id)::integer = (ph.simcard_id)::integer)
116. 2.232 2.232 ↑ 1.0 31,056 1

Seq Scan on simcards sim (cost=0.00..570.56 rows=31,056 width=16) (actual time=0.006..2.232 rows=31,056 loops=1)

117. 1.388 3.196 ↑ 1.0 11,244 1

Hash (cost=222.44..222.44 rows=11,244 width=12) (actual time=3.196..3.196 rows=11,244 loops=1)

  • Buckets: 16,384 Batches: 1 Memory Usage: 562kB
118. 1.808 1.808 ↑ 1.0 11,244 1

Seq Scan on phones ph (cost=0.00..222.44 rows=11,244 width=12) (actual time=0.005..1.808 rows=11,244 loops=1)

119. 3.642 7.642 ↑ 1.0 31,056 1

Hash (cost=570.56..570.56 rows=31,056 width=4) (actual time=7.642..7.642 rows=31,056 loops=1)

  • Buckets: 32,768 Batches: 1 Memory Usage: 1,348kB
120. 4.000 4.000 ↑ 1.0 31,056 1

Seq Scan on simcards sim_abroad (cost=0.00..570.56 rows=31,056 width=4) (actual time=0.003..4.000 rows=31,056 loops=1)

121. 0.002 0.008 ↑ 1.0 7 1

Hash (cost=1.07..1.07 rows=7 width=21) (actual time=0.008..0.008 rows=7 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
122. 0.006 0.006 ↑ 1.0 7 1

Seq Scan on deliveries_types dtt (cost=0.00..1.07 rows=7 width=21) (actual time=0.003..0.006 rows=7 loops=1)

123. 2.068 5.037 ↑ 1.0 12,951 1

Hash (cost=632.51..632.51 rows=12,951 width=28) (actual time=5.037..5.037 rows=12,951 loops=1)

  • Buckets: 16,384 Batches: 1 Memory Usage: 855kB
124. 2.969 2.969 ↑ 1.0 12,951 1

Seq Scan on cars_gps cg (cost=0.00..632.51 rows=12,951 width=28) (actual time=0.003..2.969 rows=12,951 loops=1)

125. 0.034 0.078 ↑ 1.0 168 1

Hash (cost=5.68..5.68 rows=168 width=32) (actual time=0.078..0.078 rows=168 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 19kB
126. 0.044 0.044 ↑ 1.0 168 1

Seq Scan on cars_trailers_brands ctb_c (cost=0.00..5.68 rows=168 width=32) (actual time=0.005..0.044 rows=168 loops=1)

127. 0.121 0.381 ↑ 1.0 1,226 1

Hash (cost=60.26..60.26 rows=1,226 width=4) (actual time=0.381..0.381 rows=1,226 loops=1)

  • Buckets: 2,048 Batches: 1 Memory Usage: 60kB
128. 0.260 0.260 ↑ 1.0 1,226 1

Seq Scan on cars_trailers_owners c_cto (cost=0.00..60.26 rows=1,226 width=4) (actual time=0.004..0.260 rows=1,226 loops=1)

129. 0.058 0.312 ↑ 1.0 396 1

Hash (cost=26.27..26.27 rows=396 width=13) (actual time=0.312..0.312 rows=396 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 26kB
130. 0.094 0.254 ↑ 1.0 396 1

Hash Left Join (cost=12.55..26.27 rows=396 width=13) (actual time=0.120..0.254 rows=396 loops=1)

  • Hash Cond: ((a.autocades_managers_id)::integer = (am.id)::integer)
131. 0.051 0.051 ↑ 1.0 396 1

Seq Scan on autocades a (cost=0.00..10.96 rows=396 width=13) (actual time=0.004..0.051 rows=396 loops=1)

132. 0.035 0.109 ↑ 1.0 291 1

Hash (cost=8.91..8.91 rows=291 width=8) (actual time=0.109..0.109 rows=291 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 20kB
133. 0.074 0.074 ↑ 1.0 291 1

Seq Scan on autocades_managers am (cost=0.00..8.91 rows=291 width=8) (actual time=0.005..0.074 rows=291 loops=1)

134. 0.220 0.394 ↑ 1.0 1,226 1

Hash (cost=60.26..60.26 rows=1,226 width=46) (actual time=0.394..0.394 rows=1,226 loops=1)

  • Buckets: 2,048 Batches: 1 Memory Usage: 113kB
135. 0.174 0.174 ↑ 1.0 1,226 1

Seq Scan on cars_trailers_owners tr_cto (cost=0.00..60.26 rows=1,226 width=46) (actual time=0.001..0.174 rows=1,226 loops=1)

136. 0.051 0.102 ↑ 1.0 396 1

Hash (cost=10.96..10.96 rows=396 width=9) (actual time=0.102..0.102 rows=396 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 26kB
137. 0.051 0.051 ↑ 1.0 396 1

Seq Scan on autocades tr_a (cost=0.00..10.96 rows=396 width=9) (actual time=0.002..0.051 rows=396 loops=1)

138. 0.007 0.013 ↑ 1.0 23 1

Hash (cost=1.23..1.23 rows=23 width=23) (actual time=0.013..0.013 rows=23 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 10kB
139. 0.006 0.006 ↑ 1.0 23 1

Seq Scan on temperature_sensor_models tsm_c (cost=0.00..1.23 rows=23 width=23) (actual time=0.003..0.006 rows=23 loops=1)

140. 0.002 0.006 ↑ 1.0 6 1

Hash (cost=1.06..1.06 rows=6 width=15) (actual time=0.006..0.006 rows=6 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
141. 0.004 0.004 ↑ 1.0 6 1

Seq Scan on warm_types wt_c (cost=0.00..1.06 rows=6 width=15) (actual time=0.002..0.004 rows=6 loops=1)

142. 1.100 2.592 ↑ 1.0 8,085 1

Hash (cost=322.85..322.85 rows=8,085 width=14) (actual time=2.592..2.592 rows=8,085 loops=1)

  • Buckets: 8,192 Batches: 1 Memory Usage: 423kB
143. 1.492 1.492 ↑ 1.0 8,085 1

Seq Scan on refrigeration_unit_status rusc (cost=0.00..322.85 rows=8,085 width=14) (actual time=0.003..1.492 rows=8,085 loops=1)

144. 3.490 560.319 ↓ 6.8 846 1

Hash (cost=1,100.07..1,100.07 rows=125 width=701) (actual time=560.319..560.319 rows=846 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 431kB
145. 1.086 556.829 ↓ 6.8 846 1

Nested Loop (cost=0.72..1,100.07 rows=125 width=701) (actual time=9.892..556.829 rows=846 loops=1)

146. 3.363 552.359 ↓ 6.8 846 1

Nested Loop (cost=0.43..1,060.00 rows=125 width=693) (actual time=9.876..552.359 rows=846 loops=1)

147. 545.612 545.612 ↓ 6.8 846 1

CTE Scan on meta_routes mr (cost=0.00..2.50 rows=125 width=104) (actual time=9.867..545.612 rows=846 loops=1)

148. 3.384 3.384 ↑ 1.0 1 846

Index Scan using routes_pkey on routes r (cost=0.43..8.45 rows=1 width=589) (actual time=0.004..0.004 rows=1 loops=846)

  • Index Cond: ((id)::integer = (mr.route_id)::integer)
149. 3.384 3.384 ↑ 1.0 1 846

Index Scan using cars_statuses_pkey on cars_statuses cs (cost=0.29..0.31 rows=1 width=8) (actual time=0.004..0.004 rows=1 loops=846)

  • Index Cond: ((car_id)::integer = (r.car_id)::integer)
150. 0.005 0.016 ↑ 1.0 36 1

Hash (cost=1.36..1.36 rows=36 width=4) (actual time=0.016..0.016 rows=36 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 10kB
151. 0.011 0.011 ↑ 1.0 36 1

Seq Scan on vehicles_statuses_types vst2 (cost=0.00..1.36 rows=36 width=4) (actual time=0.005..0.011 rows=36 loops=1)

152. 0.862 10.998 ↑ 1.0 1 846

Nested Loop Left Join (cost=1.12..1.25 rows=1 width=72) (actual time=0.011..0.013 rows=1 loops=846)

153. 0.854 8.460 ↑ 1.0 1 846

Nested Loop Left Join (cost=0.83..0.94 rows=1 width=66) (actual time=0.009..0.010 rows=1 loops=846)

154. 0.008 6.768 ↑ 1.0 1 846

Nested Loop Left Join (cost=0.70..0.78 rows=1 width=59) (actual time=0.008..0.008 rows=1 loops=846)

155. 0.854 5.922 ↑ 1.0 1 846

Nested Loop Left Join (cost=0.56..0.61 rows=1 width=44) (actual time=0.006..0.007 rows=1 loops=846)

156. 4.230 4.230 ↑ 1.0 1 846

Index Scan using trailers_pkey on trailers t (cost=0.42..0.44 rows=1 width=24) (actual time=0.004..0.005 rows=1 loops=846)

  • Index Cond: ((id)::integer = (r.trailer_id)::integer)
157. 0.838 0.838 ↑ 1.0 1 838

Index Scan using pk_cars_trailers_brands on cars_trailers_brands ctb_t (cost=0.14..0.16 rows=1 width=32) (actual time=0.001..0.001 rows=1 loops=838)

  • Index Cond: (id = (t.car_trailer_brand_id)::integer)
158. 0.838 0.838 ↑ 1.0 1 838

Index Scan using temperature_sensor_models_pkey on temperature_sensor_models tsm_t (cost=0.14..0.16 rows=1 width=23) (actual time=0.001..0.001 rows=1 loops=838)

  • Index Cond: (t.temperature_sensor_model_id = id)
159. 0.838 0.838 ↑ 1.0 1 838

Index Scan using warm_types_pkey on warm_types wt_t (cost=0.13..0.15 rows=1 width=15) (actual time=0.001..0.001 rows=1 loops=838)

  • Index Cond: ((id)::integer = (t.warm_type_id)::integer)
160. 1.676 1.676 ↑ 1.0 1 838

Index Scan using refrigeration_unit_status_pkey on refrigeration_unit_status rust (cost=0.28..0.30 rows=1 width=14) (actual time=0.002..0.002 rows=1 loops=838)

  • Index Cond: ((gps_device_id)::integer = (t.gps_device_id)::integer)
161. 2.538 2.538 ↑ 1.0 1 846

Index Scan using routes_extra_fields_idx on routes_extra_fields ref (cost=0.43..0.54 rows=1 width=25) (actual time=0.003..0.003 rows=1 loops=846)

  • Index Cond: ((route_id)::integer = (r.id)::integer)
162. 2.538 2.538 ↑ 1.0 1 846

Index Scan using route_pkey on route vr (cost=0.43..0.52 rows=1 width=15) (actual time=0.003..0.003 rows=1 loops=846)

  • Index Cond: ((route_id)::integer = (r.id)::integer)
163. 0.005 0.013 ↑ 1.0 4 1

Hash (cost=1.04..1.04 rows=4 width=32) (actual time=0.013..0.013 rows=4 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
164. 0.008 0.008 ↑ 1.0 4 1

Seq Scan on event_delivery_cause de_ercd (cost=0.00..1.04 rows=4 width=32) (actual time=0.006..0.008 rows=4 loops=1)

165. 0.005 0.008 ↑ 1.0 3 1

Hash (cost=1.03..1.03 rows=3 width=41) (actual time=0.008..0.008 rows=3 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
166. 0.003 0.003 ↑ 1.0 3 1

Seq Scan on event_route_cause de_erc (cost=0.00..1.03 rows=3 width=41) (actual time=0.003..0.003 rows=3 loops=1)

167. 1.692 1.692 ↑ 1.0 1 846

Index Scan using settle_pkey on settles s (cost=0.28..0.30 rows=1 width=26) (actual time=0.002..0.002 rows=1 loops=846)

  • Index Cond: ((id)::integer = (r.settle_id)::integer)
168. 2.538 2.538 ↑ 1.0 1 846

Index Scan using waypoints_pkey on waypoints w (cost=8.45..15.86 rows=1 width=20) (actual time=0.003..0.003 rows=1 loops=846)

  • Index Cond: ((id)::integer = (CASE WHEN mr.is_transit THEN s.waypoint_id ELSE (SubPlan 19) END)::integer)
169.          

SubPlan (for Index Scan)

170. 0.000 0.000 ↓ 0.0 0

Limit (cost=0.14..8.16 rows=1 width=4) (never executed)

171. 0.000 0.000 ↓ 0.0 0

Index Scan using distribution_center_pkey on distribution_centers (cost=0.14..8.16 rows=1 width=4) (never executed)

  • Index Cond: ((id)::integer = (mr.dc_id)::integer)
172. 0.000 0.000 ↓ 0.0 0

Limit (cost=0.14..8.16 rows=1 width=4) (never executed)

173. 0.000 0.000 ↓ 0.0 0

Index Scan using distribution_center_pkey on distribution_centers (cost=0.14..8.16 rows=1 width=4) (never executed)

  • Index Cond: ((id)::integer = (mr.dc_id)::integer)
174. 0.033 0.115 ↓ 1.1 250 1

Hash (cost=8.95..8.95 rows=238 width=8) (actual time=0.115..0.115 rows=250 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 18kB
175. 0.082 0.082 ↓ 1.1 250 1

Seq Scan on history_auto_open_routes haor (cost=0.00..8.95 rows=238 width=8) (actual time=0.015..0.082 rows=250 loops=1)

  • Filter: (auto_open_type_id = $34)
  • Rows Removed by Filter: 226
176. 0.006 0.012 ↑ 1.0 13 1

Hash (cost=1.13..1.13 rows=13 width=7) (actual time=0.012..0.012 rows=13 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
177. 0.006 0.006 ↑ 1.0 13 1

Seq Scan on open_route_statuses ors (cost=0.00..1.13 rows=13 width=7) (actual time=0.004..0.006 rows=13 loops=1)

178. 0.004 0.009 ↑ 1.0 8 1

Hash (cost=1.08..1.08 rows=8 width=7) (actual time=0.009..0.009 rows=8 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
179. 0.005 0.005 ↑ 1.0 8 1

Seq Scan on future_route_statuses frs (cost=0.00..1.08 rows=8 width=7) (actual time=0.003..0.005 rows=8 loops=1)

180. 1.692 1.692 ↑ 1.0 1 846

Index Scan using arm_de_tablet_car_id_idx on tablet de_t (cost=0.28..0.31 rows=1 width=8) (actual time=0.002..0.002 rows=1 loops=846)

  • Index Cond: ((car_id)::integer = (c.id)::integer)
181. 3.384 3.384 ↑ 1.0 1 846

Index Scan using direct_routes_info_idx1 on direct_routes_info dri (cost=0.43..0.53 rows=1 width=28) (actual time=0.004..0.004 rows=1 loops=846)

  • Index Cond: ((r.id)::integer = route_id)
182. 0.021 0.054 ↑ 1.0 115 1

Hash (cost=9.15..9.15 rows=115 width=30) (actual time=0.054..0.054 rows=115 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 16kB
183. 0.033 0.033 ↑ 1.0 115 1

Seq Scan on distribution_centers dc (cost=0.00..9.15 rows=115 width=30) (actual time=0.003..0.033 rows=115 loops=1)

184. 1.692 1.692 ↑ 1.0 1 846

Index Scan using users2_pkey on users u (cost=0.28..1.62 rows=1 width=54) (actual time=0.002..0.002 rows=1 loops=846)

  • Index Cond: (user_oid = (am.user_oid)::oid)
185. 0.000 0.000 ↓ 0.0 0 846

Index Scan using autocades_pkey on autocades prikom_ak (cost=0.15..0.17 rows=1 width=8) (actual time=0.000..0.000 rows=0 loops=846)

  • Index Cond: ((id)::integer = (c.receiver_autocade_id)::integer)
186. 0.032 0.110 ↑ 1.0 291 1

Hash (cost=8.91..8.91 rows=291 width=8) (actual time=0.110..0.110 rows=291 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 20kB
187. 0.078 0.078 ↑ 1.0 291 1

Seq Scan on autocades_managers am_prikom (cost=0.00..8.91 rows=291 width=8) (actual time=0.006..0.078 rows=291 loops=1)

188. 0.000 0.000 ↓ 0.0 0 846

Index Scan using users2_pkey on users am_prikom_u (cost=0.28..1.62 rows=1 width=54) (actual time=0.000..0.000 rows=0 loops=846)

  • Index Cond: (user_oid = (am_prikom.user_oid)::oid)
189. 0.000 0.000 ↓ 0.0 0 846

Index Scan using cars_trailers_owners_pkey on cars_trailers_owners r_cto (cost=0.28..0.30 rows=1 width=46) (actual time=0.000..0.000 rows=0 loops=846)

  • Index Cond: ((id)::integer = ref.open_receiver_owner_id)
190. 0.000 0.000 ↓ 0.0 0 846

Index Scan using autocades_pkey on autocades r_au (cost=0.15..0.17 rows=1 width=9) (actual time=0.000..0.000 rows=0 loops=846)

  • Index Cond: ((id)::integer = ref.open_receiver_autocade_id)
191. 2.538 2.538 ↑ 1.0 1 846

Index Scan using routes_imp_extra_fields_route_id_key on routes_imp_extra_fields rief (cost=0.42..0.45 rows=1 width=21) (actual time=0.003..0.003 rows=1 loops=846)

  • Index Cond: ((route_id)::integer = (r.id)::integer)
192. 0.010 0.020 ↑ 1.0 41 1

Hash (cost=1.41..1.41 rows=41 width=30) (actual time=0.020..0.020 rows=41 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 11kB
193. 0.010 0.010 ↑ 1.0 41 1

Seq Scan on car_comment_templates cct (cost=0.00..1.41 rows=41 width=30) (actual time=0.005..0.010 rows=41 loops=1)

194. 0.000 7.217 ↓ 0.0 0 1

Hash (cost=0.30..0.30 rows=15 width=36) (actual time=7.217..7.217 rows=0 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 8kB
195. 7.217 7.217 ↓ 0.0 0 1

CTE Scan on last_market lm (cost=0.00..0.30 rows=15 width=36) (actual time=7.217..7.217 rows=0 loops=1)

196. 716.562 722.484 ↑ 1.0 1 846

Function Scan on necessary_passes np (cost=10.50..10.51 rows=1 width=160) (actual time=0.854..0.854 rows=1 loops=846)

197.          

SubPlan (for Function Scan)

198. 2.538 5.922 ↑ 1.0 1 846

Aggregate (cost=10.24..10.25 rows=1 width=4) (actual time=0.007..0.007 rows=1 loops=846)

199. 3.384 3.384 ↑ 2.0 1 846

Index Only Scan using routes_drivers_idx on routes_drivers rd_1 (cost=0.43..10.23 rows=2 width=4) (actual time=0.004..0.004 rows=1 loops=846)

  • Index Cond: (route_id = (r.id)::integer)
  • Heap Fetches: 835
200. 0.846 4.230 ↓ 0.0 0 846

Subquery Scan on dc_info (cost=0.43..10.30 rows=1 width=76) (actual time=0.005..0.005 rows=0 loops=846)

  • Filter: ((dc_info.route_id)::integer = (r.id)::integer)
201. 0.000 3.384 ↓ 0.0 0 846

GroupAggregate (cost=0.43..10.27 rows=2 width=18) (actual time=0.004..0.004 rows=0 loops=846)

  • Group Key: rdtd.route_id
202. 3.384 3.384 ↓ 0.0 0 846

Index Scan using routes_dc_times_detail_idx on routes_dc_times_detail rdtd (cost=0.43..10.22 rows=2 width=18) (actual time=0.004..0.004 rows=0 loops=846)

  • Index Cond: ((route_id)::integer = (r.id)::integer)
203. 0.135 8.461 ↓ 4.9 836 1

Hash (cost=3.42..3.42 rows=171 width=68) (actual time=8.461..8.461 rows=836 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 95kB
204. 8.326 8.326 ↓ 4.9 836 1

CTE Scan on meta_routes_drivers mrd (cost=0.00..3.42 rows=171 width=68) (actual time=7.856..8.326 rows=836 loops=1)

205. 0.005 0.013 ↑ 1.0 9 1

Hash (cost=1.09..1.09 rows=9 width=52) (actual time=0.013..0.013 rows=9 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
206. 0.008 0.008 ↑ 1.0 9 1

Seq Scan on delivery_acception_statuses das (cost=0.00..1.09 rows=9 width=52) (actual time=0.005..0.008 rows=9 loops=1)

207. 0.004 0.010 ↑ 1.1 7 1

Hash (cost=1.08..1.08 rows=8 width=49) (actual time=0.010..0.010 rows=7 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
208. 0.006 0.006 ↑ 1.0 8 1

Seq Scan on route_acception_statuses ras (cost=0.00..1.08 rows=8 width=49) (actual time=0.004..0.006 rows=8 loops=1)

209. 1.692 1.692 ↓ 0.0 0 846

Index Scan using route_id on escalation_answers ea (cost=0.42..0.44 rows=1 width=75) (actual time=0.002..0.002 rows=0 loops=846)

  • Index Cond: (route_id = (r.id)::integer)
210. 1.692 1.692 ↓ 0.0 0 846

Index Scan using escalation_answers_route_pkey on escalation_answers_route ear (cost=0.42..0.44 rows=1 width=67) (actual time=0.002..0.002 rows=0 loops=846)

  • Index Cond: (route_id = (r.id)::integer)
211. 0.000 0.000 ↑ 1.0 1 846

Materialize (cost=0.29..9.41 rows=1 width=77) (actual time=0.000..0.000 rows=1 loops=846)

212. 0.007 0.017 ↑ 1.0 1 1

Nested Loop Left Join (cost=0.29..9.40 rows=1 width=77) (actual time=0.015..0.017 rows=1 loops=1)

  • Join Filter: ((dctt.id)::integer = (dct.deliveries_cars_tasks_types_id)::integer)
  • Rows Removed by Join Filter: 3
213. 0.007 0.007 ↑ 1.0 1 1

Index Scan using deliveries_cars_tasks_pkey on deliveries_cars_tasks dct (cost=0.29..8.31 rows=1 width=9) (actual time=0.006..0.007 rows=1 loops=1)

  • Index Cond: ((id)::integer = 94,533)
214. 0.003 0.003 ↑ 1.0 4 1

Seq Scan on deliveries_cars_tasks_types dctt (cost=0.00..1.04 rows=4 width=72) (actual time=0.002..0.003 rows=4 loops=1)

215. 0.022 0.022 ↓ 0.0 0 11

Index Scan using pg_authid_oid_index on pg_authid (cost=0.28..0.30 rows=1 width=68) (actual time=0.002..0.002 rows=0 loops=11)

  • Index Cond: (oid = r.user_oid)
  • Filter: rolcanlogin
216. 0.002 0.006 ↑ 1.0 3 1

Hash (cost=1.03..1.03 rows=3 width=17) (actual time=0.006..0.006 rows=3 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
217. 0.004 0.004 ↑ 1.0 3 1

Seq Scan on routes_schemes rs (cost=0.00..1.03 rows=3 width=17) (actual time=0.004..0.004 rows=3 loops=1)

218.          

SubPlan (for Hash Left Join)

219. 0.011 0.055 ↓ 0.0 0 11

Limit (cost=0.43..7.48 rows=1 width=12) (actual time=0.005..0.005 rows=0 loops=11)

220. 0.044 0.044 ↓ 0.0 0 11

Index Scan Backward using routes_points_manual_route_id_order_key on routes_points_manual rpm (cost=0.43..35.65 rows=5 width=12) (actual time=0.004..0.004 rows=0 loops=11)

  • Index Cond: ((route_id)::integer = (r.id)::integer)
  • Filter: ((object_var)::text = 'market'::text)
221. 0.011 0.099 ↓ 0.0 0 11

Nested Loop (cost=0.87..31.97 rows=1 width=0) (actual time=0.009..0.009 rows=0 loops=11)

  • Join Filter: ((COALESCE(rpa_1.open_route_point, false) = COALESCE(r_3.opened, false)) AND CASE WHEN (r_3.routes_type_transits IS NOT NULL) THEN ((rpa_1.type_id)::integer = ANY ('{3,4}'::integer[])) WHEN (r_3.routes_type = 0) THEN ((rpa_1.type_id)::integer = ANY ('{1,4}'::integer[])) WHEN (r_3.routes_type = 1) THEN ((rpa_1.type_id)::integer = ANY ('{2,4}'::integer[])) ELSE false END)
222. 0.044 0.044 ↑ 1.0 1 11

Index Scan using routes_pkey on routes r_3 (cost=0.43..8.45 rows=1 width=9) (actual time=0.003..0.004 rows=1 loops=11)

  • Index Cond: ((id)::integer = (r.id)::integer)
223. 0.044 0.044 ↓ 0.0 0 11

Index Scan using routes_points_all_idx3 on routes_points_all rpa_1 (cost=0.43..23.45 rows=3 width=9) (actual time=0.004..0.004 rows=0 loops=11)

  • Index Cond: ((route_id)::integer = (r.id)::integer)
  • Filter: (COALESCE((temperature_control_status)::integer, 0) > 0)
  • Rows Removed by Filter: 1
224. 0.000 0.000 ↓ 0.0 0

Hash Join (cost=647,322.32..1,366,943.77 rows=702,923 width=4) (never executed)

  • Hash Cond: (((rpa_2.route_id)::integer = (r_4.id)::integer) AND (COALESCE(rpa_2.open_route_point, false) = COALESCE(r_4.opened, false)))
  • Join Filter: CASE WHEN (r_4.routes_type_transits IS NOT NULL) THEN ((rpa_2.type_id)::integer = ANY ('{3,4}'::integer[])) WHEN (r_4.routes_type = 0) THEN ((rpa_2.type_id)::integer = ANY ('{1,4}'::integer[])) WHEN (r_4.routes_type = 1) THEN ((rpa_2.type_id)::integer = ANY ('{2,4}'::integer[])) ELSE false END
225. 0.000 0.000 ↓ 0.0 0

Seq Scan on routes_points_all rpa_2 (cost=0.00..572,816.09 rows=2,811,691 width=9) (never executed)

  • Filter: (COALESCE((temperature_control_status)::integer, 0) > 0)
226. 0.000 0.000 ↓ 0.0 0

Hash (cost=519,127.93..519,127.93 rows=6,447,493 width=9) (never executed)

227. 0.000 0.000 ↓ 0.0 0

Seq Scan on routes r_4 (cost=0.00..519,127.93 rows=6,447,493 width=9) (never executed)

228. 0.000 0.033 ↓ 0.0 0 11

Nested Loop Left Join (cost=0.56..39.18 rows=200 width=642) (actual time=0.003..0.003 rows=0 loops=11)

229. 0.011 0.033 ↓ 0.0 0 11

Nested Loop (cost=0.28..21.56 rows=2 width=4) (actual time=0.003..0.003 rows=0 loops=11)

  • Join Filter: (s_1.status = ss.id)
230. 0.022 0.022 ↓ 0.0 0 11

Index Scan using fki_sessions_delivery_id_fk on sessions s_1 (cost=0.28..20.00 rows=4 width=8) (actual time=0.002..0.002 rows=0 loops=11)

  • Index Cond: (delivery_id = (mr.delivery_id)::integer)
231. 0.000 0.000 ↓ 0.0 0

Materialize (cost=0.00..1.16 rows=7 width=4) (never executed)

232. 0.000 0.000 ↓ 0.0 0

Seq Scan on session_statuses ss (cost=0.00..1.12 rows=7 width=4) (never executed)

  • Filter: is_active_session
233. 0.000 0.000 ↓ 0.0 0

Index Scan using session_id_fk_idx on sessions_params sp (cost=0.28..8.30 rows=1 width=646) (never executed)

  • Index Cond: (session_id = s_1.id)
234. 4.081 4.081 ↑ 1.0 1 11

Function Scan on geography_distance_between_km sq_distance (cost=1.36..1.89 rows=1 width=32) (actual time=0.371..0.371 rows=1 loops=11)

235.          

Initplan (for Function Scan)

236. 0.000 0.000 ↓ 0.0 0

Seq Scan on gps_process_data_settings (cost=0.00..1.11 rows=1 width=4) (never executed)

  • Filter: ((object_var)::text = 'distribution_center'::text)
237. 0.011 0.176 ↓ 0.0 0 11

Limit (cost=32.11..32.11 rows=1 width=16) (actual time=0.016..0.016 rows=0 loops=11)

238. 0.044 0.165 ↓ 0.0 0 11

Sort (cost=32.11..32.11 rows=2 width=16) (actual time=0.015..0.015 rows=0 loops=11)

  • Sort Key: rpa_3.type_id, rpa_3.order_num
  • Sort Method: top-N heapsort Memory: 25kB
239. 0.044 0.121 ↑ 1.0 2 11

Nested Loop (cost=0.87..32.10 rows=2 width=16) (actual time=0.009..0.011 rows=2 loops=11)

  • Join Filter: ((COALESCE(rpa_3.open_route_point, false) = COALESCE(r_5.opened, false)) AND CASE WHEN (r_5.routes_type_transits IS NOT NULL) THEN ((rpa_3.type_id)::integer = ANY ('{3,4}'::integer[])) WHEN (r_5.routes_type = 0) THEN ((rpa_3.type_id)::integer = ANY ('{1,4}'::integer[])) WHEN (r_5.routes_type = 1) THEN ((rpa_3.type_id)::integer = ANY ('{2,4}'::integer[])) ELSE false END)
240. 0.044 0.044 ↑ 1.0 1 11

Index Scan using routes_pkey on routes r_5 (cost=0.43..8.45 rows=1 width=9) (actual time=0.004..0.004 rows=1 loops=11)

  • Index Cond: ((id)::integer = (r.id)::integer)
241. 0.033 0.033 ↑ 5.0 2 11

Index Scan using routes_points_all_idx3 on routes_points_all rpa_3 (cost=0.43..23.40 rows=10 width=21) (actual time=0.002..0.003 rows=2 loops=11)

  • Index Cond: ((route_id)::integer = (r.id)::integer)
Planning time : 57.411 ms
Execution time : 1,625.885 ms