explain.depesz.com

PostgreSQL's explain analyze made readable

Result: IkaT

Settings
# exclusive inclusive rows x rows loops node
1. 0.112 816.803 ↑ 3.8 11 1

Sort (cost=29,379.97..29,380.08 rows=42 width=1,881) (actual time=816.801..816.803 rows=11 loops=1)

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

CTE meta_routes

3. 410.799 479.492 ↓ 6.8 846 1

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

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

Initplan (for Hash Left Join)

5. 0.000 2.630 ↑ 1.0 1 1

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

6.          

Initplan (for Aggregate)

7. 0.009 0.009 ↑ 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.009..0.009 rows=1 loops=1)

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

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

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

Seq Scan on deliveries deliveries_1 (cost=0.00..388.31 rows=7,094 width=4) (actual time=0.055..2.619 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.653 5.982 ↓ 6.8 846 1

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

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

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

12. 2.729 2.729 ↓ 4.9 49 1

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

  • Index Cond: ((id)::integer = ANY ($5))
13. 1.372 1.372 ↓ 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.028 rows=17 loops=49)

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

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

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

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

16. 0.003 0.006 ↑ 1.0 12 1

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

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

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

18.          

SubPlan (for Hash Left Join)

19. 2.538 60.066 ↑ 1.0 1 846

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

20. 57.528 57.528 ↓ 0.0 0 846

Seq Scan on distribution_centers dc_1 (cost=0.00..11.45 rows=10 width=26) (actual time=0.033..0.068 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.009 0.009 ↓ 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.009..0.009 rows=0 loops=1)

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

CTE markets_points

24. 0.002 7.191 ↓ 0.0 0 1

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

25. 0.012 7.189 ↓ 0.0 0 1

Sort (cost=1,201.37..1,201.41 rows=15 width=58) (actual time=7.189..7.189 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.071 7.177 ↓ 0.0 0 1

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

27. 0.745 3.722 ↓ 6.8 846 1

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

28. 0.313 0.439 ↓ 6.8 846 1

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

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

CTE Scan on meta_routes mmr (cost=0.00..2.50 rows=125 width=4) (actual time=0.003..0.126 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.007 7.212 ↓ 0.0 0 1

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

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

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

38. 0.007 7.205 ↓ 0.0 0 1

Sort (cost=0.69..0.73 rows=15 width=55) (actual time=7.205..7.205 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.003 7.198 ↓ 0.0 0 1

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

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

CTE Scan on markets_points mp_1 (cost=0.00..0.30 rows=15 width=53) (actual time=7.195..7.195 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.504 8.165 ↓ 4.9 836 1

HashAggregate (cost=4,010.21..4,011.92 rows=171 width=73) (actual time=8.075..8.165 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.071 7.661 ↓ 4.9 836 1

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

46. 0.769 1.735 ↓ 1.9 209 1

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

  • Group Key: rd.route_id
47. 0.121 0.966 ↓ 1.9 209 1

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

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

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

49. 0.111 0.111 ↓ 3.5 219 1

CTE Scan on meta_routes mr2 (cost=0.00..2.50 rows=62 width=4) (actual time=0.002..0.111 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.217 5.855 ↓ 10.1 627 1

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

  • Group Key: mr3.route_id
52. 0.422 3.638 ↓ 1.0 627 1

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

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

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

54. 0.162 0.162 ↓ 10.1 627 1

CTE Scan on meta_routes mr3 (cost=0.00..2.50 rows=62 width=36) (actual time=0.001..0.162 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.009 0.009 ↑ 1.0 1 1

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

  • Filter: ((code)::text = 'future_auto_open'::text)
  • Rows Removed by Filter: 1
58. 5.202 816.682 ↑ 3.8 11 1

Hash Left Join (cost=13,180.67..20,596.12 rows=42 width=1,881) (actual time=746.658..816.682 rows=11 loops=1)

  • Hash Cond: (r.scheme_id = rs.id)
59. 0.030 806.245 ↑ 3.8 11 1

Nested Loop Left Join (cost=13,179.60..16,595.01 rows=42 width=1,872) (actual time=741.291..806.245 rows=11 loops=1)

60. 1.431 806.193 ↑ 3.8 11 1

Nested Loop Left Join (cost=13,179.32..16,581.99 rows=42 width=1,812) (actual time=741.272..806.193 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.854 804.762 ↓ 10.0 846 1

Nested Loop Left Join (cost=13,179.03..16,566.00 rows=85 width=1,819) (actual time=736.485..804.762 rows=846 loops=1)

62. 1.189 802.216 ↓ 10.0 846 1

Nested Loop Left Join (cost=13,178.61..16,527.79 rows=85 width=1,756) (actual time=736.468..802.216 rows=846 loops=1)

  • Join Filter: mr.is_transit
63. 0.918 799.335 ↓ 10.0 846 1

Hash Left Join (cost=13,178.19..16,489.52 rows=85 width=1,685) (actual time=736.441..799.335 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.920 798.406 ↓ 10.0 846 1

Hash Left Join (cost=13,176.99..16,487.68 rows=85 width=1,641) (actual time=736.412..798.406 rows=846 loops=1)

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

Hash Left Join (cost=13,175.76..16,485.80 rows=85 width=1,598) (actual time=736.377..797.471 rows=846 loops=1)

  • Hash Cond: ((r.id)::integer = (mrd.route_id)::integer)
66. 1.052 787.982 ↓ 10.0 846 1

Nested Loop Left Join (cost=13,170.20..16,479.92 rows=85 width=1,534) (actual time=727.660..787.982 rows=846 loops=1)

67. 0.569 784.392 ↓ 10.0 846 1

Hash Left Join (cost=13,169.77..15,603.59 rows=85 width=1,462) (actual time=727.631..784.392 rows=846 loops=1)

  • Hash Cond: ((mr.route_id)::integer = (lm.route_id)::integer)
  • Join Filter: (NOT mr.is_transit)
68. 0.625 776.607 ↓ 10.0 846 1

Hash Left Join (cost=13,169.28..15,602.68 rows=85 width=1,434) (actual time=720.398..776.607 rows=846 loops=1)

  • Hash Cond: (cch.comment_template = cct.id)
69. 0.397 775.962 ↓ 10.0 846 1

Nested Loop Left Join (cost=13,167.36..15,599.89 rows=85 width=1,412) (actual time=720.359..775.962 rows=846 loops=1)

70. 0.847 773.873 ↓ 10.0 846 1

Nested Loop Left Join (cost=13,167.07..15,570.51 rows=85 width=1,344) (actual time=720.340..773.873 rows=846 loops=1)

71. 0.780 770.488 ↓ 10.0 846 1

Nested Loop Left Join (cost=13,166.64..15,531.62 rows=85 width=1,327) (actual time=720.319..770.488 rows=846 loops=1)

72. 0.806 769.708 ↓ 10.0 846 1

Nested Loop Left Join (cost=13,166.50..15,516.74 rows=85 width=1,326) (actual time=720.307..769.708 rows=846 loops=1)

73. 0.795 768.902 ↓ 10.0 846 1

Nested Loop Left Join (cost=13,166.22..15,490.81 rows=85 width=1,288) (actual time=720.294..768.902 rows=846 loops=1)

74. 0.514 768.107 ↓ 10.0 846 1

Hash Left Join (cost=13,165.94..15,352.51 rows=85 width=1,242) (actual time=720.281..768.107 rows=846 loops=1)

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

Nested Loop Left Join (cost=13,153.39..15,339.38 rows=85 width=1,242) (actual time=720.153..767.482 rows=846 loops=1)

76. 0.747 766.610 ↓ 10.0 846 1

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

77. 0.811 764.171 ↓ 10.0 846 1

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

  • Hash Cond: ((r.responsible_dc_id)::integer = (dc.id)::integer)
78. 0.431 763.304 ↓ 10.0 846 1

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

79. 1.144 759.489 ↓ 10.0 846 1

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

80. 0.846 756.653 ↓ 10.0 846 1

Hash Left Join (cost=13,141.66..15,102.14 rows=85 width=1,150) (actual time=719.993..756.653 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))
81. 1.379 755.795 ↓ 10.0 846 1

Hash Left Join (cost=13,140.42..15,099.19 rows=85 width=1,157) (actual time=719.956..755.795 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))
82. 0.637 754.400 ↓ 10.0 846 1

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

  • Hash Cond: ((r.id)::integer = (haor.route_id)::integer)
83. 1.062 753.635 ↓ 10.0 846 1

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

84. 1.295 750.035 ↓ 10.0 846 1

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

85. 0.537 747.048 ↓ 10.0 846 1

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

  • Hash Cond: ((vr.route_cause_id)::integer = (de_erc.id)::integer)
86. 0.601 746.501 ↓ 10.0 846 1

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

  • Hash Cond: ((vr.delivery_cause_id)::integer = (de_ercd.id)::integer)
87. 0.436 745.887 ↓ 10.0 846 1

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

88. 0.538 742.067 ↓ 10.0 846 1

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

89. 1.233 738.145 ↓ 10.0 846 1

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

90. 0.946 725.914 ↓ 10.0 846 1

Hash Left Join (cost=13,114.23..13,504.63 rows=85 width=961) (actual time=719.496..725.914 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)
91. 0.382 724.951 ↓ 10.0 846 1

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

92. 0.001 0.009 ↑ 1.0 1 1

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

93. 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)

94. 3.538 724.560 ↓ 10.0 846 1

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

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

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

96. 1.828 719.408 ↓ 10.0 846 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 563kB
97. 8.277 717.580 ↓ 10.0 846 1

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

  • Hash Cond: ((c.id)::integer = (cs.car_id)::integer)
98. 13.736 215.197 ↑ 1.0 60,468 1

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

  • Hash Cond: ((c.gps_device_id)::integer = (rusc.gps_device_id)::integer)
99. 17.052 198.857 ↑ 1.0 60,468 1

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

  • Hash Cond: ((c.warm_type_id)::integer = (wt_c.id)::integer)
100. 12.291 181.795 ↑ 1.0 60,468 1

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

  • Hash Cond: (c.temperature_sensor_model_id = tsm_c.id)
101. 11.229 169.490 ↑ 1.0 60,468 1

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

  • Hash Cond: ((c.receiver_autocade_id)::integer = (tr_a.id)::integer)
102. 10.824 158.149 ↑ 1.0 60,468 1

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

  • Hash Cond: ((c.receiver_owner_id)::integer = (tr_cto.id)::integer)
103. 11.246 146.920 ↑ 1.0 60,468 1

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

  • Hash Cond: ((c.autocades_id)::integer = (a.id)::integer)
104. 16.982 135.360 ↑ 1.0 60,468 1

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

  • Hash Cond: ((c.company_owner_id)::integer = (c_cto.id)::integer)
105. 13.758 117.980 ↑ 1.0 60,468 1

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

  • Hash Cond: ((c.car_trailer_brand_id)::integer = ctb_c.id)
106. 15.210 104.141 ↑ 1.0 60,468 1

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

  • Hash Cond: ((c.id)::integer = (cg.car_id)::integer)
107. 15.356 83.980 ↑ 1.0 60,468 1

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

  • Hash Cond: ((c.type_delivery)::integer = dtt.id)
108. 18.123 68.615 ↑ 1.0 60,468 1

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

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

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

  • Filter: (NOT archive)
  • Rows Removed by Filter: 28,131
110. 1.818 22.251 ↑ 1.0 11,244 1

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

  • Buckets: 16,384 Batches: 1 Memory Usage: 647kB
111. 2.044 20.433 ↑ 1.0 11,244 1

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

  • Hash Cond: ((ph.simcard_abroad_id)::integer = (sim_abroad.id)::integer)
112. 5.172 10.617 ↑ 1.0 11,244 1

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

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

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

114. 1.357 3.215 ↑ 1.0 11,244 1

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

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

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

116. 3.811 7.772 ↑ 1.0 31,056 1

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

  • Buckets: 32,768 Batches: 1 Memory Usage: 1,348kB
117. 3.961 3.961 ↑ 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..3.961 rows=31,056 loops=1)

118. 0.004 0.009 ↑ 1.0 7 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
119. 0.005 0.005 ↑ 1.0 7 1

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

120. 2.155 4.951 ↑ 1.0 12,951 1

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

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

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

122. 0.033 0.081 ↑ 1.0 168 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 19kB
123. 0.048 0.048 ↑ 1.0 168 1

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

124. 0.153 0.398 ↑ 1.0 1,226 1

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

  • Buckets: 2,048 Batches: 1 Memory Usage: 60kB
125. 0.245 0.245 ↑ 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.005..0.245 rows=1,226 loops=1)

126. 0.071 0.314 ↑ 1.0 396 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 26kB
127. 0.078 0.243 ↑ 1.0 396 1

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

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

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

129. 0.039 0.112 ↑ 1.0 291 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 20kB
130. 0.073 0.073 ↑ 1.0 291 1

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

131. 0.253 0.405 ↑ 1.0 1,226 1

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

  • Buckets: 2,048 Batches: 1 Memory Usage: 113kB
132. 0.152 0.152 ↑ 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.002..0.152 rows=1,226 loops=1)

133. 0.057 0.112 ↑ 1.0 396 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 26kB
134. 0.055 0.055 ↑ 1.0 396 1

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

135. 0.006 0.014 ↑ 1.0 23 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 10kB
136. 0.008 0.008 ↑ 1.0 23 1

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

137. 0.005 0.010 ↑ 1.0 6 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
138. 0.005 0.005 ↑ 1.0 6 1

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

139. 1.087 2.604 ↑ 1.0 8,085 1

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

  • Buckets: 8,192 Batches: 1 Memory Usage: 423kB
140. 1.517 1.517 ↑ 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.004..1.517 rows=8,085 loops=1)

141. 3.186 494.106 ↓ 6.8 846 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 431kB
142. 0.474 490.920 ↓ 6.8 846 1

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

143. 2.764 487.062 ↓ 6.8 846 1

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

144. 480.914 480.914 ↓ 6.8 846 1

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

145. 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)
146. 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.003..0.004 rows=1 loops=846)

  • Index Cond: ((car_id)::integer = (r.car_id)::integer)
147. 0.008 0.017 ↑ 1.0 36 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 10kB
148. 0.009 0.009 ↑ 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.009 rows=36 loops=1)

149. 0.016 10.998 ↑ 1.0 1 846

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

150. 0.854 9.306 ↑ 1.0 1 846

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

151. 0.854 7.614 ↑ 1.0 1 846

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

152. 0.854 5.922 ↑ 1.0 1 846

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

153. 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)
154. 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)
155. 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)
156. 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)
157. 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)
158. 3.384 3.384 ↑ 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.004 rows=1 loops=846)

  • Index Cond: ((route_id)::integer = (r.id)::integer)
159. 3.384 3.384 ↑ 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.004 rows=1 loops=846)

  • Index Cond: ((route_id)::integer = (r.id)::integer)
160. 0.006 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
161. 0.007 0.007 ↑ 1.0 4 1

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

162. 0.005 0.010 ↑ 1.0 3 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
163. 0.005 0.005 ↑ 1.0 3 1

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

164. 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)
165. 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)
166.          

SubPlan (for Index Scan)

167. 0.000 0.000 ↓ 0.0 0

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

168. 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)
169. 0.000 0.000 ↓ 0.0 0

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

170. 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)
171. 0.039 0.128 ↓ 1.1 250 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 18kB
172. 0.089 0.089 ↓ 1.1 250 1

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

  • Filter: (auto_open_type_id = $34)
  • Rows Removed by Filter: 226
173. 0.008 0.016 ↑ 1.0 13 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
174. 0.008 0.008 ↑ 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.008 rows=13 loops=1)

175. 0.006 0.012 ↑ 1.0 8 1

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

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

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

177. 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)
178. 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.003..0.004 rows=1 loops=846)

  • Index Cond: ((r.id)::integer = route_id)
179. 0.022 0.056 ↑ 1.0 115 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 16kB
180. 0.034 0.034 ↑ 1.0 115 1

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

181. 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)
182. 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)
183. 0.045 0.111 ↑ 1.0 291 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 20kB
184. 0.066 0.066 ↑ 1.0 291 1

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

185. 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)
186. 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)
187. 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)
188. 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)
189. 1.692 1.692 ↓ 0.0 0 846

Index Scan using cch_route_idx on car_comments_history cch (cost=0.29..0.33 rows=2 width=72) (actual time=0.002..0.002 rows=0 loops=846)

  • Index Cond: (route_id = (r.id)::integer)
190. 0.009 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
191. 0.011 0.011 ↑ 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.011 rows=41 loops=1)

192. 0.000 7.216 ↓ 0.0 0 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 8kB
193. 7.216 7.216 ↓ 0.0 0 1

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

194. 0.000 2.538 ↓ 0.0 0 846

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

  • Filter: ((dc_info.route_id)::integer = (r.id)::integer)
195. 0.846 2.538 ↓ 0.0 0 846

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

  • Group Key: rdtd.route_id
196. 1.692 1.692 ↓ 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.002..0.002 rows=0 loops=846)

  • Index Cond: ((route_id)::integer = (r.id)::integer)
197. 0.174 8.697 ↓ 4.9 836 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 95kB
198. 8.523 8.523 ↓ 4.9 836 1

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

199. 0.006 0.015 ↑ 1.0 9 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
200. 0.009 0.009 ↑ 1.0 9 1

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

201. 0.006 0.011 ↑ 1.1 7 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
202. 0.005 0.005 ↑ 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.005 rows=8 loops=1)

203. 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)
204. 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)
205. 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)

206. 0.011 0.022 ↑ 1.0 1 1

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

  • Join Filter: ((dctt.id)::integer = (dct.deliveries_cars_tasks_types_id)::integer)
  • Rows Removed by Join Filter: 3
207. 0.008 0.008 ↑ 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.008..0.008 rows=1 loops=1)

  • Index Cond: ((id)::integer = 94,533)
208. 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)

209. 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
210. 0.006 0.010 ↑ 1.0 3 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
211. 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)

212.          

SubPlan (for Hash Left Join)

213. 0.011 0.066 ↓ 0.0 0 11

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

214. 0.055 0.055 ↓ 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.005..0.005 rows=0 loops=11)

  • Index Cond: ((route_id)::integer = (r.id)::integer)
  • Filter: ((object_var)::text = 'market'::text)
215. 0.033 0.143 ↓ 0.0 0 11

Nested Loop (cost=0.87..31.97 rows=1 width=0) (actual time=0.013..0.013 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)
216. 0.033 0.033 ↑ 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.003 rows=1 loops=11)

  • Index Cond: ((id)::integer = (r.id)::integer)
217. 0.077 0.077 ↓ 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.007..0.007 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
218. 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
219. 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)
220. 0.000 0.000 ↓ 0.0 0

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

221. 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)

222. 0.000 0.044 ↓ 0.0 0 11

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

223. 0.011 0.044 ↓ 0.0 0 11

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

  • Join Filter: (s_1.status = ss.id)
224. 0.033 0.033 ↓ 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.003..0.003 rows=0 loops=11)

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

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

226. 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
227. 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)
228. 4.752 4.752 ↑ 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.432..0.432 rows=1 loops=11)

229.          

Initplan (for Function Scan)

230. 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)
231. 0.011 0.220 ↓ 0.0 0 11

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

232. 0.055 0.209 ↓ 0.0 0 11

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

  • Sort Key: rpa_3.type_id, rpa_3.order_num
  • Sort Method: quicksort Memory: 25kB
233. 0.066 0.154 ↑ 1.0 2 11

Nested Loop (cost=0.87..32.10 rows=2 width=16) (actual time=0.013..0.014 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)
234. 0.055 0.055 ↑ 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.005..0.005 rows=1 loops=11)

  • Index Cond: ((id)::integer = (r.id)::integer)
235. 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.003..0.003 rows=2 loops=11)

  • Index Cond: ((route_id)::integer = (r.id)::integer)
Planning time : 43.058 ms
Execution time : 819.377 ms