explain.depesz.com

PostgreSQL's explain analyze made readable

Result: TFwl

Settings
# exclusive inclusive rows x rows loops node
1. 5.338 186,843.520 ↓ 2,582.0 2,582 1

GroupAggregate (cost=18,834.43..18,834.48 rows=1 width=758) (actual time=186,837.607..186,843.520 rows=2,582 loops=1)

  • Group Key: arinv.invoice, arinv.progress, arinvdet.inven, (CASE WHEN ((arinvdet.unit_meas)::text ~~ '%+%'::text) THEN inventry.each_unit ELSE arinvdet.unit_meas END), arinvdet.warehouse, arinvdet.descr, arinv.ship_date, invenwh.count, ((((invenwh.count + invenwh.pur_o) + invenwh.m_in_o) + invenwh.wt_in_o)), ((inventry.pur_o + inventry.m_in_o)), (((((((invenwh.count + invenwh.pur_o) + invenwh.m_in_o) + invenwh.wt_in_o) - invenwh.sales_o) - invenwh.m_out_o) - invenwh.wt_out_o)), (((((((invenwh.count + invenwh.pur_s) + invenwh.m_in_s) + invenwh.wt_in_s) - invenwh.sales_o) - invenwh.m_out_o) - invenwh.wt_out_o)), (((((((invenwh.count + invenwh.pur_s) + invenwh.m_in_s) + invenwh.wt_in_s) - invenwh.sales_s) - invenwh.m_out_s) - invenwh.wt_out_s)), invenwh.order_amt, (((arinvdet.mto IS FALSE) AND (arinvdet.c_type = '2'::numeric))), invenwh.m_in_o, invenwh.wt_in_o, inventry.mfg, inventry.color, inventry.gr_vendor
2. 23.020 186,838.182 ↓ 2,589.0 2,589 1

Sort (cost=18,834.43..18,834.43 rows=1 width=378) (actual time=186,837.591..186,838.182 rows=2,589 loops=1)

  • Sort Key: arinv.invoice, arinv.progress, arinvdet.inven, (CASE WHEN ((arinvdet.unit_meas)::text ~~ '%+%'::text) THEN inventry.each_unit ELSE arinvdet.unit_meas END), arinvdet.warehouse, arinvdet.descr, arinv.ship_date, invenwh.count, ((((invenwh.count + invenwh.pur_o) + invenwh.m_in_o) + invenwh.wt_in_o)), ((inventry.pur_o + inventry.m_in_o)), (((((((invenwh.count + invenwh.pur_o) + invenwh.m_in_o) + invenwh.wt_in_o) - invenwh.sales_o) - invenwh.m_out_o) - invenwh.wt_out_o)), (((((((invenwh.count + invenwh.pur_s) + invenwh.m_in_s) + invenwh.wt_in_s) - invenwh.sales_o) - invenwh.m_out_o) - invenwh.wt_out_o)), (((((((invenwh.count + invenwh.pur_s) + invenwh.m_in_s) + invenwh.wt_in_s) - invenwh.sales_s) - invenwh.m_out_s) - invenwh.wt_out_s)), invenwh.order_amt, (((arinvdet.mto IS FALSE) AND (arinvdet.c_type = '2'::numeric))), invenwh.m_in_o, invenwh.wt_in_o, inventry.mfg, inventry.color, inventry.gr_vendor
  • Sort Method: quicksort Memory: 914kB
3. 50.454 186,815.162 ↓ 2,589.0 2,589 1

Nested Loop Left Join (cost=9,479.34..18,834.43 rows=1 width=378) (actual time=1,017.741..186,815.162 rows=2,589 loops=1)

4. 12.984 35,766.461 ↓ 2,589.0 2,589 1

Nested Loop (cost=9,475.82..17,793.34 rows=1 width=183) (actual time=1,002.128..35,766.461 rows=2,589 loops=1)

5. 0.000 35,695.697 ↓ 2,889.0 2,889 1

Gather (cost=9,475.74..17,791.44 rows=1 width=176) (actual time=1,002.104..35,695.697 rows=2,889 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
6. 58,033.177 59,044.496 ↓ 963.0 963 3

Nested Loop Left Join (cost=8,475.74..16,791.34 rows=1 width=176) (actual time=896.725..59,044.496 rows=963 loops=3)

  • Join Filter: (((invenunt.id)::text = (arinvdet.inven)::text) AND ((invenunt.unit)::text = (arinvdet.unit_meas)::text))
  • Rows Removed by Join Filter: 62455365
7. 24.222 981.895 ↓ 963.0 963 3

Nested Loop (cost=8,475.74..15,590.15 rows=1 width=176) (actual time=874.775..981.895 rows=963 loops=3)

  • Join Filter: ((arinvdet.inven)::text = (inventry.id)::text)
8. 9.513 957.658 ↓ 991.0 991 3

Nested Loop Left Join (cost=8,475.68..15,590.03 rows=1 width=158) (actual time=874.683..957.658 rows=991 loops=3)

  • Filter: (apinvdet.autoid IS NULL)
  • Rows Removed by Filter: 5
9. 29.459 948.144 ↑ 2.1 996 3

Nested Loop Left Join (cost=8,475.60..15,363.14 rows=2,134 width=168) (actual time=874.674..948.144 rows=996 loops=3)

10. 30.976 918.661 ↑ 2.1 996 3

Merge Join (cost=8,475.51..8,552.52 rows=2,134 width=168) (actual time=874.643..918.661 rows=996 loops=3)

  • Merge Cond: (((invenwh.id)::text = (arinvdet.inven)::text) AND ((invenwh.warehouse)::text = (arinvdet.warehouse)::text))
11. 741.045 829.320 ↑ 1.3 33,274 3

Sort (cost=4,520.22..4,541.17 rows=41,908 width=62) (actual time=808.804..829.320 rows=33,274 loops=3)

  • Sort Key: invenwh.id, invenwh.warehouse
  • Sort Method: quicksort Memory: 6462kB
12. 88.275 88.275 ↑ 1.3 33,526 3

Parallel Seq Scan on invenwh (cost=0.00..3,876.72 rows=41,908 width=62) (actual time=0.007..88.275 rows=33,526 loops=3)

13. 18.701 58.365 ↑ 1.7 2,989 3

Sort (cost=3,955.27..3,957.87 rows=5,189 width=114) (actual time=56.279..58.365 rows=2,989 loops=3)

  • Sort Key: arinvdet.inven, arinvdet.warehouse
  • Sort Method: quicksort Memory: 777kB
14. 39.664 39.664 ↑ 1.7 2,989 3

Index Scan using arinvdet_status_idx on arinvdet (cost=0.09..3,891.23 rows=5,189 width=114) (actual time=0.083..39.664 rows=2,989 loops=3)

  • Index Cond: (status = 0.0)
  • Filter: ((mto IS NOT TRUE) AND ((id)::text !~~ '($)%'::text) AND (quan <> ship))
  • Rows Removed by Filter: 12975
15. 0.024 0.024 ↓ 0.0 0 2,989

Index Scan using idx_btree_inlink_cdoc on inlink (cost=0.09..3.19 rows=1 width=20) (actual time=0.024..0.024 rows=0 loops=2,989)

  • Index Cond: ((arinvdet."timestamp")::text = (cdoc_stamp)::text)
16. 0.001 0.001 ↓ 0.0 0 2,989

Index Scan using idx_btree_apinvdet_timestamp on apinvdet (cost=0.08..0.10 rows=1 width=27) (actual time=0.001..0.001 rows=0 loops=2,989)

  • Index Cond: ((inlink.vdoc_stamp)::text = ("timestamp")::text)
17. 0.015 0.015 ↑ 1.0 1 2,974

Index Scan using idx_btree_inventry_id on inventry (cost=0.06..0.12 rows=1 width=42) (actual time=0.013..0.015 rows=1 loops=2,974)

  • Index Cond: ((id)::text = (invenwh.id)::text)
  • Filter: (c_type = 2.0)
  • Rows Removed by Filter: 0
18. 29.424 29.424 ↑ 1.0 64,856 2,889

Seq Scan on invenunt (cost=0.00..939.37 rows=65,456 width=18) (actual time=0.004..29.424 rows=64,856 loops=2,889)

19. 57.780 57.780 ↑ 1.0 1 2,889

Index Scan using arinv_pkey on arinv (cost=0.08..1.90 rows=1 width=41) (actual time=0.020..0.020 rows=1 loops=2,889)

  • Index Cond: ((autoid)::text = (arinvdet.doc_aid)::text)
  • Filter: (is_rma IS NOT TRUE)
  • Rows Removed by Filter: 0
20. 85,320.495 150,998.247 ↑ 1.0 1 2,589

Hash Right Join (cost=3.52..1,041.07 rows=1 width=49) (actual time=14.724..58.323 rows=1 loops=2,589)

  • Hash Cond: (((invenunt_1.id)::text = (arinvdet2.inven)::text) AND ((invenunt_1.unit)::text = (arinvdet2.unit_meas)::text))
21. 65,620.794 65,620.794 ↑ 1.0 64,856 2,589

Seq Scan on invenunt invenunt_1 (cost=0.00..939.37 rows=65,456 width=27) (actual time=0.005..25.346 rows=64,856 loops=2,589)

22. 10.356 56.958 ↑ 1.0 1 2,589

Hash (cost=3.51..3.51 rows=1 width=35) (actual time=0.022..0.022 rows=1 loops=2,589)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
23. 46.602 46.602 ↑ 1.0 1 2,589

Index Scan using arinvdet_pkey on arinvdet arinvdet2 (cost=0.09..3.51 rows=1 width=35) (actual time=0.017..0.018 rows=1 loops=2,589)

  • Index Cond: ((autoid)::text = (arinvdet.autoid)::text)
Planning time : 57.433 ms
Execution time : 186,844.624 ms