explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 1GC5

Settings
# exclusive inclusive rows x rows loops node
1. 4.110 1,309.424 ↓ 10.5 660 1

Sort (cost=24,869.51..24,869.67 rows=63 width=443) (actual time=1,309.203..1,309.424 rows=660 loops=1)

  • Sort Key: l.created_at DESC
  • Sort Method: quicksort Memory: 367kB
2. 17.562 1,305.314 ↓ 10.5 660 1

Nested Loop (cost=279.36..24,867.62 rows=63 width=443) (actual time=10.718..1,305.314 rows=660 loops=1)

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

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

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

Seq Scan on load_execution_link lel (cost=0.00..442.02 rows=13,696 width=36) (actual time=0.018..6.651 rows=13,963 loops=1)

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

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

  • Buckets: 1024 Batches: 1 Memory Usage: 39kB
6. 0.556 0.684 ↓ 1.6 385 1

Bitmap Heap Scan on load l (cost=6.81..275.87 rows=246 width=45) (actual time=0.158..0.684 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.128 0.128 ↓ 1.6 391 1

Bitmap Index Scan on idx_load_created_at (cost=0.00..6.75 rows=246 width=0) (actual time=0.128..0.128 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. 12.250 12.250 ↑ 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.012..0.014 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. 1.150 6.325 ↓ 0.0 0 575

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

11. 2.300 5.175 ↓ 0.0 0 575

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

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

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

13. 2.300 2.300 ↓ 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.004..0.004 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. 96.360 96.360 ↑ 1.0 1 660

Seq Scan on code c (cost=0.00..20.54 rows=1 width=12) (actual time=0.044..0.146 rows=1 loops=660)

  • Filter: (l.status = code)
  • Rows Removed by Filter: 762
16. 1.320 3.300 ↓ 0.0 0 660

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

17. 1.980 1.980 ↓ 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.003..0.003 rows=0 loops=660)

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

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

19. 2.688 11.880 ↓ 10.0 10 660

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

  • Join Filter: (e.created_by_user_id = ull_2.user_id)
  • Rows Removed by Join Filter: 2
20. 1.320 1.320 ↓ 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.002..0.002 rows=0 loops=660)

  • Index Cond: (load_id = lf.load_id)
21. 7.872 7.872 ↓ 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.016..0.082 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.660 182.160 ↓ 0.0 0 660

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

23. 57.852 181.500 ↓ 0.0 0 660

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

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

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

  • Filter: (assignment_active AND (load_id = lf.load_id))
  • Rows Removed by Filter: 388
25. 65.568 65.568 ↑ 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.008..32.784 rows=153,675 loops=2)

26. 0.660 11.880 ↓ 0.0 0 660

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

27. 1.047 11.220 ↓ 0.0 0 660

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

  • Join Filter: (e_1.created_by_user_id = ull_4.user_id)
  • Rows Removed by Join Filter: 0
28. 9.900 9.900 ↓ 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.014..0.015 rows=0 loops=660)

  • Index Cond: (load_id = l.id)
  • Filter: (event_code = 250)
  • Rows Removed by Filter: 11
29. 0.273 0.273 ↑ 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.003..0.003 rows=1 loops=91)

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

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

31. 7.920 7.920 ↑ 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.011..0.012 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. 3.960 17.820 ↑ 1.0 1 660

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

33.          

Initplan (for Result)

34. 1.560 13.860 ↓ 2.0 2 660

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

35. 5.940 5.940 ↑ 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.008..0.009 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. 6.360 6.360 ↑ 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.007..0.008 rows=1 loops=795)

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

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

38. 0.912 30.360 ↑ 1.0 1 660

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

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

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

40. 4.287 19.800 ↑ 1.0 1 660

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

41. 3.300 3.300 ↓ 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.004..0.005 rows=2 loops=660)

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

Bitmap Heap Scan on document_link dl (cost=8.65..12.68 rows=1 width=20) (actual time=0.009..0.009 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. 1.357 9.499 ↓ 0.0 0 1,357

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

44. 5.428 5.428 ↓ 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.004..0.004 rows=0 loops=1,357)

  • Index Cond: ((parent_type = 1728) AND (lel.id = parent_id))
45. 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 = 1705) AND (s_2.id = parent_id))
46. 3.640 3.640 ↑ 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.005..0.005 rows=1 loops=728)

  • Index Cond: (id = dl.document_id)
  • Heap Fetches: 728
47. 4.368 4.368 ↑ 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.005..0.006 rows=1 loops=728)

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

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

49. 0.456 33.660 ↓ 0.0 0 660

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

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

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

51. 4.725 27.720 ↑ 1.0 1 660

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

52. 2.640 2.640 ↓ 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.004..0.004 rows=2 loops=660)

  • Index Cond: ((parent_type = 1700) AND (lf.load_id = parent_id) AND (status = 2101))
53. 13.570 20.355 ↑ 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.015..0.015 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. 1.357 6.785 ↓ 0.0 0 1,357

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

55. 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))
56. 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 = 1705) AND (s_3.id = parent_id))
57. 2.184 2.184 ↑ 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.002..0.003 rows=1 loops=728)

  • Index Cond: (id = dl_1.document_id)
  • Heap Fetches: 728
58. 2.184 2.184 ↓ 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.003..0.003 rows=0 loops=728)

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

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

60. 1.116 19.800 ↓ 0.0 0 660

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

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

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

62. 3.775 13.200 ↑ 1.0 1 660

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

63. 2.640 2.640 ↓ 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.004..0.004 rows=2 loops=660)

  • Index Cond: ((parent_type = 1700) AND (lf.load_id = parent_id) AND (status = 2101))
64. 1.357 6.785 ↑ 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.005..0.005 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 5.428 ↓ 0.0 0 1,357

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

66. 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))
67. 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 = 1705) AND (s_4.id = parent_id))
68. 2.184 2.184 ↑ 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.002..0.003 rows=1 loops=728)

  • Index Cond: (id = dl_2.document_id)
  • Heap Fetches: 728
69. 2.184 2.184 ↓ 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.003..0.003 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. 1.320 6.600 ↑ 1.0 1 660

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

71. 5.280 5.280 ↑ 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.007..0.008 rows=1 loops=660)

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

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

73. 3.960 826.980 ↓ 0.0 0 660

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

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

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

75. 818.400 818.400 ↓ 0.0 0 660

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

  • Filter: (parent_id = lel.id)
  • Rows Removed by Filter: 4546
76. 2.250 2.250 ↑ 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.008..0.009 rows=1 loops=250)

  • Index Cond: (id = ur.user_id)
Planning time : 8.028 ms
Execution time : 1,310.116 ms