explain.depesz.com

PostgreSQL's explain analyze made readable

Result: R9CN

Settings
# exclusive inclusive rows x rows loops node
1. 0.026 70,888.176 ↓ 29.0 29 1

Subquery Scan on vw_invoices_all_picking (cost=67,643.89..67,643.90 rows=1 width=589) (actual time=70,888.149..70,888.176 rows=29 loops=1)

2. 0.347 70,888.150 ↓ 29.0 29 1

Sort (cost=67,643.89..67,643.89 rows=1 width=593) (actual time=70,888.144..70,888.150 rows=29 loops=1)

  • Sort Key: vw_invoices_all_base.has_changed DESC, ((vw_invoices_all_base."time")::date), vw_invoices_all_base.is_rushed DESC, vw_invoices_all_base."time", vw_invoices_all_base.lane, vw_invoices_all_base.customer_priority, vw_invoices_all_base.invoice_priority
  • Sort Method: quicksort Memory: 37kB
3. 0.097 70,887.803 ↓ 29.0 29 1

Subquery Scan on vw_invoices_all_base (cost=50,026.92..67,643.88 rows=1 width=593) (actual time=1,118.310..70,887.803 rows=29 loops=1)

4. 1.042 70,887.706 ↓ 29.0 29 1

Nested Loop (cost=50,026.92..67,643.86 rows=1 width=589) (actual time=1,118.307..70,887.706 rows=29 loops=1)

  • Join Filter: ((arinvdet.warehouse)::text = (inwh.warehouse)::text)
5. 0.349 70,883.416 ↓ 29.0 29 1

Nested Loop Left Join (cost=50,026.92..65,066.78 rows=1 width=535) (actual time=1,118.165..70,883.416 rows=29 loops=1)

  • Join Filter: (pick_jobs.id = pick_jobs_shelved.pick_job)
  • Rows Removed by Join Filter: 1421
6. 0.106 70,882.168 ↓ 29.0 29 1

Nested Loop Left Join (cost=50,007.16..65,046.88 rows=1 width=527) (actual time=1,118.056..70,882.168 rows=29 loops=1)

7. 0.219 70,881.801 ↓ 29.0 29 1

Nested Loop Left Join (cost=50,006.89..65,043.41 rows=1 width=523) (actual time=1,118.024..70,881.801 rows=29 loops=1)

8. 0.757 70,881.234 ↓ 29.0 29 1

Merge Left Join (cost=50,006.61..65,040.20 rows=1 width=529) (actual time=1,117.995..70,881.234 rows=29 loops=1)

  • Merge Cond: (((arinvdet.doc_aid)::text = (pick_jobs_updated.original_invoice)::text) AND ((arinvdet.warehouse)::text = (pick_jobs_updated.original_warehouse)::text))
9. 0.775 70,867.023 ↓ 29.0 29 1

Merge Left Join (cost=49,152.51..64,123.73 rows=1 width=525) (actual time=1,105.691..70,867.023 rows=29 loops=1)

  • Merge Cond: (((arinvdet.doc_aid)::text = (pick_jobs_deleted.original_invoice)::text) AND ((arinvdet.warehouse)::text = (pick_jobs_deleted.original_warehouse)::text))
10. 0.102 70,853.016 ↓ 29.0 29 1

Nested Loop Left Join (cost=38,782.09..52,360.31 rows=1 width=507) (actual time=1,093.576..70,853.016 rows=29 loops=1)

11. 0.583 70,852.885 ↓ 29.0 29 1

Nested Loop (cost=38,781.94..52,360.15 rows=1 width=494) (actual time=1,093.567..70,852.885 rows=29 loops=1)

  • Join Filter: (NOT COALESCE(CASE WHEN (true) THEN ((arinv.ship_date <> pick_jobs.original_ship_date) OR ((arinv.ship_via)::text <> (pick_jobs.original_ship_method)::text)) ELSE true END, false))
  • Rows Removed by Join Filter: 1
12. 2,291.827 70,848.694 ↓ 12.6 164 1

Nested Loop (cost=38,781.52..52,316.55 rows=13 width=232) (actual time=549.708..70,848.694 rows=164 loops=1)

  • Join Filter: ((arinvdet.doc_aid)::text = (scheduled_invoices.invoice_autoid)::text)
  • Rows Removed by Join Filter: 11662036
13. 5.621 163.047 ↓ 660.0 660 1

Nested Loop Left Join (cost=11,496.28..11,809.35 rows=1 width=63) (actual time=135.122..163.047 rows=660 loops=1)

  • Filter: (pick_jobs.finished IS NULL)
14. 4.246 140.926 ↓ 17.4 660 1

Group (cost=11,495.87..11,496.16 rows=38 width=24) (actual time=135.095..140.926 rows=660 loops=1)

  • Group Key: arinvdet.doc_aid, arinvdet.warehouse
15. 10.508 136.680 ↓ 81.6 3,101 1

Sort (cost=11,495.87..11,495.97 rows=38 width=24) (actual time=135.091..136.680 rows=3,101 loops=1)

  • Sort Key: arinvdet.doc_aid, arinvdet.warehouse
  • Sort Method: quicksort Memory: 339kB
16. 2.758 126.172 ↓ 81.6 3,101 1

Nested Loop (cost=0.43..11,494.87 rows=38 width=24) (actual time=2.876..126.172 rows=3,101 loops=1)

17. 113.439 113.439 ↓ 83.1 665 1

Seq Scan on arinv arinv_1 (cost=0.00..10,944.11 rows=8 width=17) (actual time=2.847..113.439 rows=665 loops=1)

  • Filter: ((is_rma IS NOT TRUE) AND (progress < '80'::numeric) AND ((status)::text = 'U'::text))
  • Rows Removed by Filter: 106344
18. 9.975 9.975 ↑ 1.2 5 665

Index Scan using arinvdet_docaid_idx on arinvdet (cost=0.43..68.79 rows=6 width=24) (actual time=0.011..0.015 rows=5 loops=665)

  • Index Cond: ((doc_aid)::text = (arinv_1.autoid)::text)
  • Filter: ((quan > 0.0) AND ((id)::text !~~ '($)%'::text))
  • Rows Removed by Filter: 0
19. 16.500 16.500 ↓ 0.0 0 660

Index Scan using uc_invoice_warehouse on pick_jobs (cost=0.41..8.22 rows=1 width=106) (actual time=0.025..0.025 rows=0 loops=660)

  • Index Cond: (((arinvdet.doc_aid)::text = (invoice)::text) AND ((arinvdet.warehouse)::text = (warehouse)::text))
20. 3,208.260 68,393.820 ↓ 1.9 17,670 660

Append (cost=27,285.24..40,297.61 rows=9,315 width=209) (actual time=0.399..103.627 rows=17,670 loops=660)

21.          

CTE scheduled_invoices

22. 1.955 277.521 ↑ 1.3 499 1

Nested Loop Left Join (cost=15,738.79..16,341.14 rows=660 width=124) (actual time=261.240..277.521 rows=499 loops=1)

23. 15.745 275.067 ↑ 1.3 499 1

Merge Left Join (cost=15,738.51..16,100.09 rows=660 width=147) (actual time=261.177..275.067 rows=499 loops=1)

  • Merge Cond: (((arinv_3.invoice)::text = ((invoice.invoice_id)::text)) AND (arinv_3.company = ((invoice.company)::text)))
24. 2.830 89.598 ↑ 1.3 499 1

Sort (cost=13,180.47..13,182.12 rows=660 width=144) (actual time=89.480..89.598 rows=499 loops=1)

  • Sort Key: arinv_3.invoice, arinv_3.company
  • Sort Method: quicksort Memory: 95kB
25. 0.947 86.768 ↑ 1.3 499 1

Hash Left Join (cost=1,476.16..13,149.56 rows=660 width=144) (actual time=27.376..86.768 rows=499 loops=1)

  • Hash Cond: ((arinv_3.ship_cat = customer_entry.ship_cat) AND (arinv_3.ship_date = customer_entry.date) AND ((((COALESCE((arinv_3.c_id)::text, ''::text) || COALESCE((arinv_3.c_zip)::text, ''::text)) || '_'::text) || COALESCE((arinv_3.c_address1)::text, ''::text)) = (customer_entry.sch_cust_id)::text))
  • Filter: ((arinv_3.ship_cat > 2) OR (customer_entry.load_id IS NOT NULL))
  • Rows Removed by Filter: 80
26. 0.701 58.655 ↑ 1.2 579 1

Subquery Scan on arinv_3 (cost=0.29..11,667.83 rows=710 width=232) (actual time=0.029..58.655 rows=579 loops=1)

  • Filter: (arinv_3.progress >= '40'::numeric)
  • Rows Removed by Filter: 1474
27. 0.688 57.954 ↑ 1.0 2,053 1

Append (cost=0.29..11,641.21 rows=2,130 width=1,206) (actual time=0.025..57.954 rows=2,053 loops=1)

28. 0.422 0.422 ↓ 1.1 188 1

Index Scan using idx_btree_arinv_status on arinv arinv_4 (cost=0.29..52.75 rows=169 width=395) (actual time=0.025..0.422 rows=188 loops=1)

  • Index Cond: ((status)::text = 'U'::text)
29. 0.496 2.251 ↑ 1.0 982 1

Subquery Scan on *SELECT* 2_1 (cost=0.42..523.80 rows=1,025 width=442) (actual time=0.038..2.251 rows=982 loops=1)

30. 1.755 1.755 ↑ 1.0 982 1

Index Scan using arinv_status_idx on arinv arinv_5 (cost=0.42..513.55 rows=1,025 width=450) (actual time=0.036..1.755 rows=982 loops=1)

  • Index Cond: ((status)::text = 'U'::text)
31. 52.334 52.334 ↑ 1.1 883 1

Seq Scan on arinv arinv_6 (cost=0.00..10,676.59 rows=935 width=447) (actual time=0.209..52.334 rows=883 loops=1)

  • Filter: ((status)::text = 'U'::text)
  • Rows Removed by Filter: 106126
32. 0.002 2.259 ↓ 0.0 0 1

Subquery Scan on *SELECT* 4 (cost=0.00..377.02 rows=1 width=630) (actual time=2.259..2.259 rows=0 loops=1)

33. 2.257 2.257 ↓ 0.0 0 1

Seq Scan on arinv arinv_7 (cost=0.00..377.01 rows=1 width=602) (actual time=2.257..2.257 rows=0 loops=1)

  • Filter: ((status)::text = 'U'::text)
  • Rows Removed by Filter: 3441
34. 15.543 27.166 ↑ 1.0 32,577 1

Hash (cost=905.77..905.77 rows=32,577 width=41) (actual time=27.165..27.166 rows=32,577 loops=1)

  • Buckets: 32768 Batches: 1 Memory Usage: 2689kB
35. 11.623 11.623 ↑ 1.0 32,577 1

Seq Scan on customer_entry (cost=0.00..905.77 rows=32,577 width=41) (actual time=0.024..11.623 rows=32,577 loops=1)

36. 150.758 169.724 ↑ 1.0 27,857 1

Sort (cost=2,558.04..2,627.79 rows=27,899 width=23) (actual time=164.201..169.724 rows=27,857 loops=1)

  • Sort Key: ((invoice.invoice_id)::text), ((invoice.company)::text)
  • Sort Method: quicksort Memory: 2955kB
37. 18.966 18.966 ↑ 1.0 27,899 1

Seq Scan on invoice (cost=0.00..497.99 rows=27,899 width=23) (actual time=0.032..18.966 rows=27,899 loops=1)

38. 0.499 0.499 ↑ 1.0 1 499

Index Scan using uc_id_date on load (cost=0.28..0.31 rows=1 width=24) (actual time=0.001..0.001 rows=1 loops=499)

  • Index Cond: (id = customer_entry.load_id)
39.          

CTE rushed_invoices

40. 106.002 106.002 ↑ 1.1 11 1

Seq Scan on arinv arinv_8 (cost=0.00..10,944.11 rows=12 width=21) (actual time=16.216..106.002 rows=11 loops=1)

  • Filter: (is_rushed AND (progress >= '30'::numeric) AND ((status)::text = 'U'::text))
  • Rows Removed by Filter: 106998
41. 401.280 401.280 ↑ 1.3 499 660

CTE Scan on scheduled_invoices (cost=0.00..13.20 rows=660 width=235) (actual time=0.399..0.608 rows=499 loops=660)

42. 1.320 116.820 ↑ 6.0 1 660

Subquery Scan on *SELECT* 2 (cost=21.45..21.98 rows=6 width=209) (actual time=0.059..0.177 rows=1 loops=660)

43. 6.970 115.500 ↑ 6.0 1 660

Hash Anti Join (cost=21.45..21.91 rows=6 width=205) (actual time=0.057..0.175 rows=1 loops=660)

  • Hash Cond: ((rushed_invoices.autoid)::text = (scheduled_invoices_1.invoice_autoid)::text)
44. 108.240 108.240 ↑ 1.1 11 660

CTE Scan on rushed_invoices (cost=0.00..0.24 rows=12 width=36) (actual time=0.025..0.164 rows=11 loops=660)

45. 0.143 0.290 ↑ 1.3 499 1

Hash (cost=13.20..13.20 rows=660 width=32) (actual time=0.290..0.290 rows=499 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 32kB
46. 0.147 0.147 ↑ 1.3 499 1

CTE Scan on scheduled_invoices scheduled_invoices_1 (cost=0.00..13.20 rows=660 width=32) (actual time=0.003..0.147 rows=499 loops=1)

47. 4,869.471 64,667.460 ↓ 2.0 17,170 660

Hash Anti Join (cost=21.84..12,884.10 rows=8,649 width=194) (actual time=1.101..97.981 rows=17,170 loops=660)

  • Hash Cond: ((pick_jobs_1.invoice)::text = (rushed_invoices_1.autoid)::text)
48. 4,436.232 59,797.980 ↓ 2.0 17,171 660

Hash Anti Join (cost=21.45..12,774.49 rows=8,655 width=17) (actual time=1.099..90.603 rows=17,171 loops=660)

  • Hash Cond: ((pick_jobs_1.invoice)::text = (scheduled_invoices_2.invoice_autoid)::text)
49. 55,361.460 55,361.460 ↑ 1.0 17,310 660

Seq Scan on pick_jobs pick_jobs_1 (cost=0.00..11,908.10 rows=17,310 width=17) (actual time=1.096..83.881 rows=17,310 loops=660)

50. 0.139 0.288 ↑ 1.3 499 1

Hash (cost=13.20..13.20 rows=660 width=32) (actual time=0.288..0.288 rows=499 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 32kB
51. 0.149 0.149 ↑ 1.3 499 1

CTE Scan on scheduled_invoices scheduled_invoices_2 (cost=0.00..13.20 rows=660 width=32) (actual time=0.004..0.149 rows=499 loops=1)

52. 0.004 0.009 ↑ 1.1 11 1

Hash (cost=0.24..0.24 rows=12 width=32) (actual time=0.009..0.009 rows=11 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
53. 0.005 0.005 ↑ 1.1 11 1

CTE Scan on rushed_invoices rushed_invoices_1 (cost=0.00..0.24 rows=12 width=32) (actual time=0.002..0.005 rows=11 loops=1)

54. 3.608 3.608 ↓ 0.0 0 164

Index Scan using arinv_pkey on arinv (cost=0.42..3.34 rows=1 width=279) (actual time=0.022..0.022 rows=0 loops=164)

  • Index Cond: ((autoid)::text = (scheduled_invoices.invoice_autoid)::text)
  • Filter: ((is_rma IS NOT TRUE) AND (progress < '80'::numeric) AND (progress < 60.0))
  • Rows Removed by Filter: 1
55. 0.029 0.029 ↓ 0.0 0 29

Index Scan using user_pkey on "user" (cost=0.14..0.16 rows=1 width=17) (actual time=0.001..0.001 rows=0 loops=29)

  • Index Cond: (pick_jobs."current_user" = id)
56. 0.737 13.232 ↑ 51.5 1,134 1

Unique (cost=10,370.43..10,887.03 rows=58,425 width=93) (actual time=12.092..13.232 rows=1,134 loops=1)

57. 5.627 12.495 ↑ 51.6 1,336 1

Sort (cost=10,370.43..10,542.63 rows=68,880 width=93) (actual time=12.089..12.495 rows=1,336 loops=1)

  • Sort Key: pick_jobs_deleted.original_invoice, pick_jobs_deleted.original_warehouse, pick_jobs_deleted.time_deleted DESC NULLS LAST
  • Sort Method: quicksort Memory: 164kB
58. 6.868 6.868 ↑ 47.3 1,456 1

Seq Scan on pick_jobs_deleted (cost=0.00..1,303.80 rows=68,880 width=93) (actual time=0.725..6.868 rows=1,456 loops=1)

59. 0.739 13.454 ↑ 2.2 1,212 1

Unique (cost=854.09..877.28 rows=2,612 width=79) (actual time=12.285..13.454 rows=1,212 loops=1)

60. 5.801 12.715 ↑ 2.2 1,436 1

Sort (cost=854.09..861.82 rows=3,091 width=79) (actual time=12.283..12.715 rows=1,436 loops=1)

  • Sort Key: pick_jobs_updated.original_invoice, pick_jobs_updated.original_warehouse, pick_jobs_updated.time_updated DESC NULLS LAST
  • Sort Method: quicksort Memory: 170kB
61. 6.914 6.914 ↑ 2.0 1,549 1

Seq Scan on pick_jobs_updated (cost=0.00..674.91 rows=3,091 width=79) (actual time=0.130..6.914 rows=1,549 loops=1)

62. 0.348 0.348 ↑ 1.0 1 29

Index Scan using arcust_id_idx on arcust (cost=0.29..3.19 rows=1 width=8) (actual time=0.011..0.012 rows=1 loops=29)

  • Index Cond: ((arinv.id)::text = (id)::text)
63. 0.261 0.261 ↓ 0.0 0 29

Index Scan using uc_invoice_warehosue on invoice_pictures (cost=0.27..3.45 rows=1 width=71) (actual time=0.009..0.009 rows=0 loops=29)

  • Index Cond: (((arinvdet.doc_aid)::text = (invoice)::text) AND ((arinvdet.warehouse)::text = (warehouse)::text))
64. 0.580 0.899 ↓ 9.8 49 29

Unique (cost=19.76..19.78 rows=5 width=44) (actual time=0.003..0.031 rows=49 loops=29)

65. 0.287 0.319 ↓ 9.8 49 29

Sort (cost=19.76..19.77 rows=5 width=44) (actual time=0.003..0.011 rows=49 loops=29)

  • Sort Key: pick_jobs_shelved.pick_job, pick_jobs_shelved.shelved_time DESC NULLS LAST
  • Sort Method: quicksort Memory: 27kB
66. 0.032 0.032 ↓ 9.8 49 1

Seq Scan on pick_jobs_shelved (cost=0.00..19.70 rows=5 width=44) (actual time=0.019..0.032 rows=49 loops=1)

  • Filter: (unshelved_time IS NULL)
67. 0.116 0.116 ↑ 1.0 1 29

Seq Scan on inwh (cost=0.00..1.05 rows=1 width=64) (actual time=0.004..0.004 rows=1 loops=29)

  • Filter: ((autoid)::text = '2GA89EVTVE3SGAD1'::text)
  • Rows Removed by Filter: 2
68.          

SubPlan (forNested Loop)

69. 0.087 1.160 ↑ 1.0 1 29

Aggregate (cost=95.42..95.43 rows=1 width=8) (actual time=0.040..0.040 rows=1 loops=29)

70. 0.232 1.073 ↓ 0.0 0 29

Unique (cost=95.38..95.40 rows=1 width=154) (actual time=0.037..0.037 rows=0 loops=29)

71. 0.551 0.841 ↓ 0.0 0 29

Sort (cost=95.38..95.39 rows=1 width=154) (actual time=0.029..0.029 rows=0 loops=29)

  • Sort Key: arinvdet_1.autoid, arinvdet_1.descr, arinvdet_1.unit_meas, ((gbl_functions.fn_mainunit_to_uom_qty(inventry.id, arinvdet_1.unit_meas, arinvdet_1.quan))::integer), ((NULLIF((arinvdet_1.gpar_time)::text, ''::text))::character varying), (COALESCE(pick_transactions.qty_shipped, 0))
  • Sort Method: quicksort Memory: 25kB
72. 0.029 0.290 ↓ 0.0 0 29

Nested Loop Left Join (cost=1.55..95.37 rows=1 width=154) (actual time=0.010..0.010 rows=0 loops=29)

73. 0.029 0.261 ↓ 0.0 0 29

Nested Loop (cost=1.13..86.68 rows=1 width=132) (actual time=0.009..0.009 rows=0 loops=29)

74. 0.058 0.232 ↓ 0.0 0 29

Nested Loop (cost=0.71..78.23 rows=1 width=132) (actual time=0.008..0.008 rows=0 loops=29)

75. 0.116 0.174 ↓ 0.0 0 29

Nested Loop (cost=0.43..69.91 rows=1 width=130) (actual time=0.006..0.006 rows=0 loops=29)

  • Join Filter: ((arinvdet_1.warehouse)::text = (inwh_1.warehouse)::text)
76. 0.058 0.058 ↓ 0.0 0 29

Seq Scan on inwh inwh_1 (cost=0.00..1.05 rows=1 width=64) (actual time=0.002..0.002 rows=0 loops=29)

  • Filter: ((autoid)::text = (arinvdet.warehouse)::text)
  • Rows Removed by Filter: 4
77. 0.000 0.000 ↓ 0.0 0

Index Scan using arinvdet_docaid_idx on arinvdet arinvdet_1 (cost=0.43..68.79 rows=6 width=105) (never executed)

  • Index Cond: ((doc_aid)::text = (arinvdet.doc_aid)::text)
  • Filter: ((quan > 0.0) AND ((id)::text !~~ '($)%'::text))
78. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_btree_inventry_id on inventry (cost=0.29..8.31 rows=1 width=12) (never executed)

  • Index Cond: ((id)::text = (arinvdet_1.inven)::text)
  • Filter: (((c_type <> 1.0) OR (auto_cost IS NOT TRUE)) AND (discou_typ <= 0))
79. 0.000 0.000 ↓ 0.0 0

Index Scan using arinv_pkey on arinv arinv_2 (cost=0.42..8.44 rows=1 width=17) (never executed)

  • Index Cond: ((autoid)::text = (arinvdet.doc_aid)::text)
  • Filter: ((is_rma IS NOT TRUE) AND (progress < '80'::numeric) AND ((status)::text = 'U'::text))
80. 0.000 0.000 ↓ 0.0 0

Index Scan using uc_item on pick_transactions (cost=0.42..8.44 rows=1 width=21) (never executed)

  • Index Cond: ((arinvdet_1.autoid)::text = (item)::text)
81. 0.406 0.522 ↑ 1.0 1 29

Aggregate (cost=2,467.44..2,467.45 rows=1 width=8) (actual time=0.017..0.018 rows=1 loops=29)

82. 0.087 0.116 ↓ 0.0 0 29

Bitmap Heap Scan on pick_transactions pick_transactions_1 (cost=13.76..2,465.72 rows=689 width=17) (actual time=0.004..0.004 rows=0 loops=29)

  • Recheck Cond: (pick_job = pick_jobs.id)
83. 0.029 0.029 ↓ 0.0 0 29

Bitmap Index Scan on idx_btree_picktransactions_pickjob (cost=0.00..13.59 rows=689 width=0) (actual time=0.001..0.001 rows=0 loops=29)

  • Index Cond: (pick_job = pick_jobs.id)
84. 0.841 0.841 ↓ 0.0 0 29

Seq Scan on "user" user_1 (cost=0.00..6.56 rows=1 width=13) (actual time=0.029..0.029 rows=0 loops=29)

  • Filter: (id = pick_jobs_deleted.original_picker)
  • Rows Removed by Filter: 205
85. 0.609 0.609 ↓ 0.0 0 29

Seq Scan on "user" user_1_1 (cost=0.00..6.56 rows=1 width=13) (actual time=0.021..0.021 rows=0 loops=29)

  • Filter: (id = pick_jobs_updated.original_picker)
  • Rows Removed by Filter: 205
Planning time : 14.155 ms
Execution time : 70,890.288 ms