explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Bzwo

Settings
# exclusive inclusive rows x rows loops node
1. 2.434 569.432 ↓ 10.5 660 1

Sort (cost=24,098.07..24,098.23 rows=63 width=443) (actual time=569.246..569.432 rows=660 loops=1)

  • Sort Key: l.created_at DESC
  • Sort Method: quicksort Memory: 367kB
2. 6.509 566.998 ↓ 10.5 660 1

Nested Loop (cost=279.36..24,096.19 rows=63 width=443) (actual time=2.784..566.998 rows=660 loops=1)

  • Join Filter: (l.id = lf.load_id)
3. 2.259 6.329 ↓ 1.5 875 1

Hash Join (cost=278.95..778.19 rows=586 width=81) (actual time=1.613..6.329 rows=875 loops=1)

  • Hash Cond: (lel.load_id = l.id)
4. 3.461 3.461 ↓ 1.0 13,964 1

Seq Scan on load_execution_link lel (cost=0.00..442.02 rows=13,696 width=36) (actual time=0.013..3.461 rows=13,964 loops=1)

  • Filter: (status <> 11202)
  • Rows Removed by Filter: 86
5. 0.080 0.609 ↓ 1.6 385 1

Hash (cost=275.87..275.87 rows=246 width=45) (actual time=0.609..0.609 rows=385 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 39kB
6. 0.460 0.529 ↓ 1.6 385 1

Bitmap Heap Scan on load l (cost=6.81..275.87 rows=246 width=45) (actual time=0.091..0.529 rows=385 loops=1)

  • Recheck Cond: ((created_at >= '2020-03-01 14:30:00+00'::timestamp with time zone) AND (created_at <= COALESCE(now(), now())))
  • Heap Blocks: exact=148
7. 0.069 0.069 ↓ 1.6 391 1

Bitmap Index Scan on idx_load_created_at (cost=0.00..6.75 rows=246 width=0) (actual time=0.069..0.069 rows=391 loops=1)

  • Index Cond: ((created_at >= '2020-03-01 14:30:00+00'::timestamp with time zone) AND (created_at <= COALESCE(now(), now())))
8. 6.125 6.125 ↑ 1.0 1 875

Index Scan using idx_load_fact_load_id on load_fact lf (cost=0.41..1.66 rows=1 width=237) (actual time=0.006..0.007 rows=1 loops=875)

  • Index Cond: (load_id = lel.load_id)
  • Filter: ((lel.shipper_business_id = shipper_business_id) AND (lel.carrier_business_id = carrier_business_id) AND ((shipper_business_id = '1703858125129385245'::bigint) OR (carrier_business_id = '1703858125129385245'::bigint)))
  • Rows Removed by Filter: 2
9.          

SubPlan (for Nested Loop)

10. 0.575 2.875 ↓ 0.0 0 575

Limit (cost=16.62..16.62 rows=1 width=40) (actual time=0.005..0.005 rows=0 loops=575)

11. 1.150 2.300 ↓ 0.0 0 575

Sort (cost=16.62..16.62 rows=1 width=40) (actual time=0.004..0.004 rows=0 loops=575)

  • Sort Key: ull.id DESC
  • Sort Method: quicksort Memory: 25kB
12. 0.000 1.150 ↓ 0.0 0 575

Nested Loop (cost=0.56..16.61 rows=1 width=40) (actual time=0.002..0.002 rows=0 loops=575)

13. 1.150 1.150 ↓ 0.0 0 575

Index Scan using idx_user_load_link_load_id_deassigned_at_deassigned_by_user_id on user_load_link ull (cost=0.27..8.29 rows=1 width=16) (actual time=0.002..0.002 rows=0 loops=575)

  • Index Cond: (load_id = l.id)
14. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_business_user_id_status on business_user bu (cost=0.29..8.30 rows=1 width=37) (never executed)

  • Index Cond: (id = ull.user_id)
15. 1.980 1.980 ↑ 1.0 1 660

Index Scan using idx_code_code on code c (cost=0.28..8.29 rows=1 width=12) (actual time=0.003..0.003 rows=1 loops=660)

  • Index Cond: (l.status = code)
16. 0.660 1.320 ↓ 0.0 0 660

Limit (cost=0.27..4.29 rows=1 width=1) (actual time=0.002..0.002 rows=0 loops=660)

17. 0.660 0.660 ↓ 0.0 0 660

Index Only Scan using idx_user_load_link_load_id_deassigned_at_deassigned_by_user_id on user_load_link ull_1 (cost=0.27..4.29 rows=1 width=1) (actual time=0.001..0.001 rows=0 loops=660)

  • Index Cond: ((load_id = lf.load_id) AND (deassigned_at IS NULL))
  • Heap Fetches: 58
18. 0.660 7.260 ↑ 1.0 1 660

Aggregate (cost=38.96..38.98 rows=1 width=1) (actual time=0.011..0.011 rows=1 loops=660)

19. 1.428 6.600 ↓ 10.0 10 660

Nested Loop (cost=0.56..38.96 rows=1 width=0) (actual time=0.004..0.010 rows=10 loops=660)

  • Join Filter: (e.created_by_user_id = ull_2.user_id)
  • Rows Removed by Join Filter: 2
20. 0.660 0.660 ↓ 0.0 0 660

Index Scan using idx_user_load_link_load_id_deassigned_at_deassigned_by_user_id on user_load_link ull_2 (cost=0.27..8.29 rows=1 width=16) (actual time=0.001..0.001 rows=0 loops=660)

  • Index Cond: (load_id = lf.load_id)
21. 4.512 4.512 ↓ 2.9 80 96

Index Scan using idx_event_load_id on event e (cost=0.29..30.32 rows=28 width=16) (actual time=0.010..0.047 rows=80 loops=96)

  • Index Cond: (load_id = lf.load_id)
  • Filter: ((event_code = 4302) AND ((event_type = 4402) OR (event_type = 4403)))
  • Rows Removed by Filter: 23
22. 0.000 97.020 ↓ 0.0 0 660

Limit (cost=0.00..15.09 rows=1 width=1) (actual time=0.147..0.147 rows=0 loops=660)

23. 31.148 97.020 ↓ 0.0 0 660

Nested Loop (cost=0.00..6,775.71 rows=449 width=1) (actual time=0.147..0.147 rows=0 loops=660)

  • Join Filter: (usl.user_id = ull_3.user_id)
  • Rows Removed by Join Filter: 466
24. 27.720 27.720 ↓ 0.0 0 660

Seq Scan on user_load_link ull_3 (cost=0.00..13.82 rows=1 width=8) (actual time=0.042..0.042 rows=0 loops=660)

  • Filter: (assignment_active AND (load_id = lf.load_id))
  • Rows Removed by Filter: 388
25. 38.152 38.152 ↑ 1.0 153,675 2

Seq Scan on user_security_logs usl (cost=0.00..4,833.06 rows=154,306 width=8) (actual time=0.005..19.076 rows=153,675 loops=2)

26. 0.660 6.600 ↓ 0.0 0 660

Limit (cost=0.56..38.44 rows=1 width=1) (actual time=0.010..0.010 rows=0 loops=660)

27. 0.000 5.940 ↓ 0.0 0 660

Nested Loop (cost=0.56..38.44 rows=1 width=1) (actual time=0.009..0.009 rows=0 loops=660)

  • Join Filter: (e_1.created_by_user_id = ull_4.user_id)
  • Rows Removed by Join Filter: 0
28. 5.940 5.940 ↓ 0.0 0 660

Index Scan using idx_event_load_id on event e_1 (cost=0.29..30.13 rows=1 width=16) (actual time=0.008..0.009 rows=0 loops=660)

  • Index Cond: (load_id = l.id)
  • Filter: (event_code = 250)
  • Rows Removed by Filter: 11
29. 0.182 0.182 ↑ 1.0 1 91

Index Scan using idx_user_load_link_load_id_deassigned_at_deassigned_by_user_id on user_load_link ull_4 (cost=0.27..8.29 rows=1 width=16) (actual time=0.002..0.002 rows=1 loops=91)

  • Index Cond: ((load_id = l.id) AND (deassigned_at IS NULL) AND (deassigned_by_user_id IS NULL))
30. 0.000 4.620 ↑ 1.0 1 660

Aggregate (cost=8.44..8.46 rows=1 width=1) (actual time=0.007..0.007 rows=1 loops=660)

31. 4.620 4.620 ↑ 1.0 1 660

Index Scan using idx_stop_code_status on stop s (cost=0.42..8.44 rows=1 width=0) (actual time=0.006..0.007 rows=1 loops=660)

  • Index Cond: ((parent_type = 1700) AND (lf.load_id = parent_id) AND (status = 2101))
  • Filter: (appointment_needed IS TRUE)
  • Rows Removed by Filter: 1
32. 1.320 9.240 ↑ 1.0 1 660

Result (cost=17.02..17.03 rows=1 width=32) (actual time=0.014..0.014 rows=1 loops=660)

33.          

Initplan (for Result)

34. 0.645 7.920 ↓ 2.0 2 660

Nested Loop Left Join (cost=0.83..17.02 rows=1 width=12) (actual time=0.010..0.012 rows=2 loops=660)

35. 3.300 3.300 ↑ 1.0 1 660

Index Scan using idx_stop_parent_index on stop s_1 (cost=0.42..8.44 rows=1 width=12) (actual time=0.005..0.005 rows=1 loops=660)

  • Index Cond: ((parent_type = 1700) AND (lf.load_id = parent_id))
  • Filter: ((appointment_needed IS TRUE) AND (status = 2101))
  • Rows Removed by Filter: 1
36. 3.975 3.975 ↑ 1.0 1 795

Index Scan using idx_appointment_parent_type_parent_id_status on appointment a (cost=0.41..8.56 rows=1 width=16) (actual time=0.004..0.005 rows=1 loops=795)

  • Index Cond: ((s_1.id = parent_id) AND (status = 9002))
37. 0.000 15.840 ↑ 1.0 1 660

Aggregate (cost=22.44..22.46 rows=1 width=1) (actual time=0.024..0.024 rows=1 loops=660)

38. 1.116 15.840 ↑ 1.0 1 660

Nested Loop (cost=9.63..22.44 rows=1 width=0) (actual time=0.018..0.024 rows=1 loops=660)

  • Join Filter: (dl.document_id = a_1.document_id)
39. 0.456 12.540 ↑ 1.0 1 660

Nested Loop (cost=9.35..21.89 rows=1 width=16) (actual time=0.015..0.019 rows=1 loops=660)

40. 2.492 9.900 ↑ 1.0 1 660

Nested Loop (cost=9.07..21.13 rows=1 width=8) (actual time=0.013..0.015 rows=1 loops=660)

41. 1.980 1.980 ↓ 2.0 2 660

Index Scan using idx_stop_code_status on stop s_2 (cost=0.42..8.44 rows=1 width=8) (actual time=0.002..0.003 rows=2 loops=660)

  • Index Cond: ((parent_type = 1700) AND (lf.load_id = parent_id) AND (status = 2101))
42. 1.357 5.428 ↑ 1.0 1 1,357

Bitmap Heap Scan on document_link dl (cost=8.65..12.68 rows=1 width=20) (actual time=0.004..0.004 rows=1 loops=1,357)

  • Recheck Cond: (((parent_type = 1728) AND (lel.id = parent_id)) OR ((parent_type = 1705) AND (s_2.id = parent_id)))
  • Heap Blocks: exact=647
43. 0.000 4.071 ↓ 0.0 0 1,357

BitmapOr (cost=8.65..8.65 rows=1 width=0) (actual time=0.003..0.003 rows=0 loops=1,357)

44. 2.714 2.714 ↓ 0.0 0 1,357

Bitmap Index Scan on idx_document_link_parent_type_parent_id (cost=0.00..4.29 rows=1 width=0) (actual time=0.002..0.002 rows=0 loops=1,357)

  • Index Cond: ((parent_type = 1728) AND (lel.id = parent_id))
45. 1.357 1.357 ↓ 0.0 0 1,357

Bitmap Index Scan on idx_document_link_parent_type_parent_id (cost=0.00..4.29 rows=1 width=0) (actual time=0.001..0.001 rows=0 loops=1,357)

  • Index Cond: ((parent_type = 1705) AND (s_2.id = parent_id))
46. 2.184 2.184 ↑ 1.0 1 728

Index Only Scan using document_pkey on document d (cost=0.28..0.76 rows=1 width=8) (actual time=0.002..0.003 rows=1 loops=728)

  • Index Cond: (id = dl.document_id)
  • Heap Fetches: 728
47. 2.184 2.184 ↑ 1.0 1 728

Index Scan using idx_attachment_document_id on attachment a_1 (cost=0.28..0.54 rows=1 width=8) (actual time=0.003..0.003 rows=1 loops=728)

  • Index Cond: (document_id = d.id)
  • Filter: (type = 2601)
  • Rows Removed by Filter: 0
48. 0.660 11.220 ↑ 1.0 1 660

Aggregate (cost=22.44..22.46 rows=1 width=1) (actual time=0.017..0.017 rows=1 loops=660)

49. 0.592 10.560 ↓ 0.0 0 660

Nested Loop (cost=9.63..22.44 rows=1 width=0) (actual time=0.016..0.016 rows=0 loops=660)

  • Join Filter: (dl_1.document_id = a_2.document_id)
50. 1.252 9.240 ↑ 1.0 1 660

Nested Loop (cost=9.35..21.89 rows=1 width=16) (actual time=0.010..0.014 rows=1 loops=660)

51. 1.869 7.260 ↑ 1.0 1 660

Nested Loop (cost=9.07..21.13 rows=1 width=8) (actual time=0.009..0.011 rows=1 loops=660)

52. 1.320 1.320 ↓ 2.0 2 660

Index Scan using idx_stop_code_status on stop s_3 (cost=0.42..8.44 rows=1 width=8) (actual time=0.002..0.002 rows=2 loops=660)

  • Index Cond: ((parent_type = 1700) AND (lf.load_id = parent_id) AND (status = 2101))
53. 1.357 4.071 ↑ 1.0 1 1,357

Bitmap Heap Scan on document_link dl_1 (cost=8.65..12.68 rows=1 width=20) (actual time=0.003..0.003 rows=1 loops=1,357)

  • Recheck Cond: (((parent_type = 1728) AND (lel.id = parent_id)) OR ((parent_type = 1705) AND (s_3.id = parent_id)))
  • Heap Blocks: exact=647
54. 0.000 2.714 ↓ 0.0 0 1,357

BitmapOr (cost=8.65..8.65 rows=1 width=0) (actual time=0.002..0.002 rows=0 loops=1,357)

55. 1.357 1.357 ↓ 0.0 0 1,357

Bitmap Index Scan on idx_document_link_parent_type_parent_id (cost=0.00..4.29 rows=1 width=0) (actual time=0.001..0.001 rows=0 loops=1,357)

  • Index Cond: ((parent_type = 1728) AND (lel.id = parent_id))
56. 1.357 1.357 ↓ 0.0 0 1,357

Bitmap Index Scan on idx_document_link_parent_type_parent_id (cost=0.00..4.29 rows=1 width=0) (actual time=0.001..0.001 rows=0 loops=1,357)

  • Index Cond: ((parent_type = 1705) AND (s_3.id = parent_id))
57. 0.728 0.728 ↑ 1.0 1 728

Index Only Scan using document_pkey on document d_1 (cost=0.28..0.76 rows=1 width=8) (actual time=0.001..0.001 rows=1 loops=728)

  • Index Cond: (id = dl_1.document_id)
  • Heap Fetches: 728
58. 0.728 0.728 ↓ 0.0 0 728

Index Scan using idx_attachment_document_id on attachment a_2 (cost=0.28..0.54 rows=1 width=8) (actual time=0.001..0.001 rows=0 loops=728)

  • Index Cond: (document_id = d_1.id)
  • Filter: (type = 2604)
  • Rows Removed by Filter: 1
59. 0.660 11.220 ↑ 1.0 1 660

Aggregate (cost=22.44..22.46 rows=1 width=1) (actual time=0.016..0.017 rows=1 loops=660)

60. 0.524 10.560 ↓ 0.0 0 660

Nested Loop (cost=9.63..22.44 rows=1 width=0) (actual time=0.016..0.016 rows=0 loops=660)

  • Join Filter: (dl_2.document_id = a_3.document_id)
61. 0.592 8.580 ↑ 1.0 1 660

Nested Loop (cost=9.35..21.89 rows=1 width=16) (actual time=0.010..0.013 rows=1 loops=660)

62. 1.869 7.260 ↑ 1.0 1 660

Nested Loop (cost=9.07..21.13 rows=1 width=8) (actual time=0.009..0.011 rows=1 loops=660)

63. 1.320 1.320 ↓ 2.0 2 660

Index Scan using idx_stop_code_status on stop s_4 (cost=0.42..8.44 rows=1 width=8) (actual time=0.002..0.002 rows=2 loops=660)

  • Index Cond: ((parent_type = 1700) AND (lf.load_id = parent_id) AND (status = 2101))
64. 1.357 4.071 ↑ 1.0 1 1,357

Bitmap Heap Scan on document_link dl_2 (cost=8.65..12.68 rows=1 width=20) (actual time=0.003..0.003 rows=1 loops=1,357)

  • Recheck Cond: (((parent_type = 1728) AND (lel.id = parent_id)) OR ((parent_type = 1705) AND (s_4.id = parent_id)))
  • Heap Blocks: exact=647
65. 0.000 2.714 ↓ 0.0 0 1,357

BitmapOr (cost=8.65..8.65 rows=1 width=0) (actual time=0.002..0.002 rows=0 loops=1,357)

66. 1.357 1.357 ↓ 0.0 0 1,357

Bitmap Index Scan on idx_document_link_parent_type_parent_id (cost=0.00..4.29 rows=1 width=0) (actual time=0.001..0.001 rows=0 loops=1,357)

  • Index Cond: ((parent_type = 1728) AND (lel.id = parent_id))
67. 1.357 1.357 ↓ 0.0 0 1,357

Bitmap Index Scan on idx_document_link_parent_type_parent_id (cost=0.00..4.29 rows=1 width=0) (actual time=0.001..0.001 rows=0 loops=1,357)

  • Index Cond: ((parent_type = 1705) AND (s_4.id = parent_id))
68. 0.728 0.728 ↑ 1.0 1 728

Index Only Scan using document_pkey on document d_2 (cost=0.28..0.76 rows=1 width=8) (actual time=0.001..0.001 rows=1 loops=728)

  • Index Cond: (id = dl_2.document_id)
  • Heap Fetches: 728
69. 1.456 1.456 ↓ 0.0 0 728

Index Scan using idx_attachment_document_id on attachment a_3 (cost=0.28..0.54 rows=1 width=8) (actual time=0.002..0.002 rows=0 loops=728)

  • Index Cond: (document_id = d_2.id)
  • Filter: ((mime_type)::text = ANY ('{image/jpeg,image/png}'::text[]))
  • Rows Removed by Filter: 1
70. 0.660 3.300 ↑ 1.0 1 660

Aggregate (cost=8.31..8.32 rows=1 width=4) (actual time=0.005..0.005 rows=1 loops=660)

71. 2.640 2.640 ↑ 1.0 1 660

Index Only Scan using idx_load_execution_link_load_shipper_carrier_business_status on load_execution_link lel_1 (cost=0.29..8.30 rows=1 width=0) (actual time=0.004..0.004 rows=1 loops=660)

  • Index Cond: ((load_id = lf.load_id) AND (shipper_business_id = lf.shipper_business_id))
  • Heap Fetches: 768
72. 0.660 375.540 ↓ 0.0 0 660

Limit (cost=131.66..131.67 rows=1 width=32) (actual time=0.569..0.569 rows=0 loops=660)

73. 1.320 374.880 ↓ 0.0 0 660

Sort (cost=131.66..131.67 rows=1 width=32) (actual time=0.568..0.568 rows=0 loops=660)

  • Sort Key: ((((bu_1.first_name)::text || ' '::text) || (bu_1.last_name)::text)) DESC
  • Sort Method: quicksort Memory: 25kB
74. 1.640 373.560 ↓ 0.0 0 660

Nested Loop (cost=0.29..131.66 rows=1 width=32) (actual time=0.471..0.566 rows=0 loops=660)

75. 370.920 370.920 ↓ 0.0 0 660

Seq Scan on user_representative ur (cost=0.00..123.34 rows=1 width=8) (actual time=0.461..0.562 rows=0 loops=660)

  • Filter: (parent_id = lel.id)
  • Rows Removed by Filter: 4547
76. 1.000 1.000 ↑ 1.0 1 250

Index Scan using idx_business_user_id_status on business_user bu_1 (cost=0.29..8.30 rows=1 width=21) (actual time=0.004..0.004 rows=1 loops=250)

  • Index Cond: (id = ur.user_id)
Planning time : 6.309 ms
Execution time : 570.340 ms