explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 9J8o

Settings
# exclusive inclusive rows x rows loops node
1. 0.168 6,937.430 ↑ 5.5 2 1

HashAggregate (cost=423,509.76..423,509.79 rows=11 width=36) (actual time=6,937.429..6,937.430 rows=2 loops=1)

2. 0.022 6,937.262 ↓ 9.0 99 1

Append (cost=0.63..423,509.75 rows=11 width=36) (actual time=96.252..6,937.262 rows=99 loops=1)

3. 0.740 708.190 ↓ 45.5 91 1

Nested Loop Left Join (cost=0.63..104,638.84 rows=2 width=31) (actual time=96.252..708.190 rows=91 loops=1)

  • Join Filter: (at.id = pt.tax_id)
  • Rows Removed by Join Filter: 2006
4. 0.046 707.268 ↓ 45.5 91 1

Nested Loop Left Join (cost=0.63..104,636.57 rows=2 width=31) (actual time=96.172..707.268 rows=91 loops=1)

5. 0.108 706.585 ↓ 45.5 91 1

Nested Loop (cost=0.54..104,636.36 rows=2 width=31) (actual time=96.121..706.585 rows=91 loops=1)

  • Join Filter: (((sp.type)::text <> 'in'::text) OR ((sl_source.usage)::text <> 'supplier'::text) OR ((sp.type)::text <> 'out'::text) OR ((sl_dest.usage)::text <> 'supplier'::text))
6. 0.107 706.295 ↓ 45.5 91 1

Nested Loop (cost=0.48..104,636.10 rows=2 width=43) (actual time=96.113..706.295 rows=91 loops=1)

7. 0.300 705.915 ↓ 45.5 91 1

Nested Loop (cost=0.43..104,635.84 rows=2 width=39) (actual time=96.100..705.915 rows=91 loops=1)

8. 24.321 703.849 ↓ 588.7 1,766 1

Nested Loop Left Join (cost=0.34..104,633.89 rows=3 width=40) (actual time=14.822..703.849 rows=1,766 loops=1)

  • Filter: (((ail.id IS NOT NULL) AND ((ai.state)::text <> ALL ('{open,paid}'::text[])) AND ((ai.type)::text = ANY ('{out_invoice,out_refund}'::text[]))) OR (ail.id IS NULL))
  • Rows Removed by Filter: 26891
9. 2.161 622.214 ↓ 12.3 28,657 1

Nested Loop Left Join (cost=0.26..104,328.82 rows=2,337 width=48) (actual time=0.400..622.214 rows=28,657 loops=1)

10. 7.411 505.425 ↓ 12.3 28,657 1

Nested Loop (cost=0.17..103,371.41 rows=2,337 width=44) (actual time=0.372..505.425 rows=28,657 loops=1)

11. 5.358 359.829 ↓ 2.1 27,637 1

Nested Loop (cost=0.09..96,727.01 rows=12,896 width=19) (actual time=0.338..359.829 rows=27,637 loops=1)

12. 289.692 289.692 ↓ 1.5 4,983 1

Seq Scan on sale_order so (cost=0.00..28,079.00 rows=3,288 width=8) (actual time=0.298..289.692 rows=4,983 loops=1)

  • Filter: ((partner_invoice_id IS NOT NULL) AND ((order_policy)::text = 'picking'::text) AND (partner_invoice_id = ANY ('{69713,69817,233174,236119,236120}'::integer[])))
  • Rows Removed by Filter: 565253
13. 64.779 64.779 ↑ 1.7 6 4,983

Index Scan using sale_order_line_order_id_index on sale_order_line l (cost=0.09..20.85 rows=10 width=19) (actual time=0.007..0.013 rows=6 loops=4,983)

  • Index Cond: (order_id = so.id)
14. 138.185 138.185 ↑ 4.0 1 27,637

Index Scan using stock_move_sale_line_id_index on stock_move m (cost=0.09..0.50 rows=4 width=29) (actual time=0.004..0.005 rows=1 loops=27,637)

  • Index Cond: ((sale_line_id = l.id) AND (sale_line_id IS NOT NULL))
  • Filter: ((state)::text = 'done'::text)
  • Rows Removed by Filter: 0
15. 114.628 114.628 ↑ 4.0 1 28,657

Index Scan using account_invoice_line_move_prod_id_index on account_invoice_line ail (cost=0.09..0.40 rows=4 width=12) (actual time=0.003..0.004 rows=1 loops=28,657)

  • Index Cond: (move_prod_id = m.id)
16. 57.314 57.314 ↑ 1.0 1 28,657

Index Scan using account_invoice_pkey on account_invoice ai (cost=0.08..0.13 rows=1 width=20) (actual time=0.002..0.002 rows=1 loops=28,657)

  • Index Cond: (id = ail.invoice_id)
17. 1.766 1.766 ↓ 0.0 0 1,766

Index Scan using stock_picking_pkey on stock_picking sp (cost=0.08..0.65 rows=1 width=7) (actual time=0.001..0.001 rows=0 loops=1,766)

  • Index Cond: (id = m.picking_id)
  • Filter: (((type)::text = ANY ('{in,out}'::text[])) AND (((invoice_state)::text <> 'none'::text) OR (blocking_code IS NULL)))
  • Rows Removed by Filter: 0
18. 0.273 0.273 ↑ 1.0 1 91

Index Scan using stock_location_pkey on stock_location sl_dest (cost=0.06..0.13 rows=1 width=12) (actual time=0.003..0.003 rows=1 loops=91)

  • Index Cond: (id = m.location_dest_id)
19. 0.182 0.182 ↑ 1.0 1 91

Index Scan using stock_location_pkey on stock_location sl_source (cost=0.06..0.13 rows=1 width=12) (actual time=0.002..0.002 rows=1 loops=91)

  • Index Cond: (id = m.location_id)
20. 0.637 0.637 ↑ 1.0 1 91

Index Only Scan using product_taxes_rel_prod_id_tax_id_key on product_taxes_rel pt (cost=0.08..0.10 rows=1 width=8) (actual time=0.006..0.007 rows=1 loops=91)

  • Index Cond: (prod_id = m.product_id)
  • Heap Fetches: 0
21. 0.155 0.182 ↑ 1.0 23 91

Materialize (cost=0.00..2.09 rows=23 width=8) (actual time=0.000..0.002 rows=23 loops=91)

22. 0.027 0.027 ↑ 1.0 23 1

Seq Scan on account_tax at (cost=0.00..2.07 rows=23 width=8) (actual time=0.011..0.027 rows=23 loops=1)

23. 0.350 6,229.050 ↑ 1.1 8 1

Nested Loop Left Join (cost=233,576.28..318,870.87 rows=9 width=22) (actual time=4,285.739..6,229.050 rows=8 loops=1)

24. 0.017 6,228.668 ↑ 1.1 8 1

Nested Loop Left Join (cost=233,576.25..318,870.52 rows=9 width=22) (actual time=4,285.712..6,228.668 rows=8 loops=1)

25. 0.046 6,228.579 ↑ 1.1 8 1

Nested Loop (cost=233,576.17..318,869.62 rows=9 width=22) (actual time=4,285.695..6,228.579 rows=8 loops=1)

  • Join Filter: (((sp_1.type)::text <> 'in'::text) OR ((sl_source_1.usage)::text <> 'supplier'::text) OR ((sp_1.type)::text <> 'out'::text) OR ((sl_dest_1.usage)::text <> 'supplier'::text))
26. 0.025 6,228.501 ↑ 1.1 8 1

Nested Loop (cost=233,576.11..318,868.59 rows=9 width=34) (actual time=4,285.673..6,228.501 rows=8 loops=1)

27. 225.805 6,228.436 ↑ 1.1 8 1

Nested Loop (cost=233,576.05..318,867.58 rows=9 width=30) (actual time=4,285.664..6,228.436 rows=8 loops=1)

28. 341.764 4,626.855 ↓ 263.9 458,592 1

Hash Left Join (cost=233,575.97..318,003.14 rows=1,738 width=27) (actual time=2,527.130..4,626.855 rows=458,592 loops=1)

  • Hash Cond: (ail_1.invoice_id = ai_1.id)
  • Filter: (((ail_1.id IS NOT NULL) AND ((ai_1.state)::text <> ALL ('{open,paid}'::text[])) AND ((ai_1.type)::text = ANY ('{out_invoice,out_refund}'::text[]))) OR (ail_1.id IS NULL))
  • Rows Removed by Filter: 268020
29. 927.640 4,066.208 ↑ 1.8 726,612 1

Hash Right Join (cost=216,465.53..292,189.67 rows=1,338,928 width=35) (actual time=2,306.184..4,066.208 rows=726,612 loops=1)

  • Hash Cond: (ail_1.move_prod_id = m_1.id)
30. 833.568 833.568 ↑ 1.0 1,720,204 1

Seq Scan on account_invoice_line ail_1 (cost=0.00..71,519.66 rows=1,720,220 width=12) (actual time=0.008..833.568 rows=1,720,204 loops=1)

31. 274.931 2,305.000 ↑ 1.8 726,223 1

Hash (cost=211,779.28..211,779.28 rows=1,338,928 width=31) (actual time=2,305.000..2,305.000 rows=726,223 loops=1)

  • Buckets: 262144 Batches: 1 Memory Usage: 43900kB
32. 2,030.069 2,030.069 ↑ 1.8 726,223 1

Seq Scan on stock_move m_1 (cost=0.00..211,779.28 rows=1,338,928 width=31) (actual time=0.017..2,030.069 rows=726,223 loops=1)

  • Filter: ((sale_line_id IS NULL) AND ((state)::text = 'done'::text))
  • Rows Removed by Filter: 3589647
33. 74.587 218.883 ↑ 1.0 267,945 1

Hash (cost=16,171.12..16,171.12 rows=268,375 width=20) (actual time=218.883..218.883 rows=267,945 loops=1)

  • Buckets: 32768 Batches: 1 Memory Usage: 13781kB
34. 144.296 144.296 ↑ 1.0 267,945 1

Seq Scan on account_invoice ai_1 (cost=0.00..16,171.12 rows=268,375 width=20) (actual time=0.007..144.296 rows=267,945 loops=1)

35. 1,375.776 1,375.776 ↓ 0.0 0 458,592

Index Scan using stock_picking_pkey on stock_picking sp_1 (cost=0.08..0.49 rows=1 width=11) (actual time=0.003..0.003 rows=0 loops=458,592)

  • Index Cond: (id = m_1.picking_id)
  • Filter: ((((invoice_state)::text <> 'none'::text) OR (blocking_code IS NULL)) AND ((type)::text = ANY ('{in,out}'::text[])) AND (partner_id = ANY ('{69713,69817,233174,236119,236120}'::integer[])))
  • Rows Removed by Filter: 1
36. 0.040 0.040 ↑ 1.0 1 8

Index Scan using stock_location_pkey on stock_location sl_dest_1 (cost=0.06..0.11 rows=1 width=12) (actual time=0.005..0.005 rows=1 loops=8)

  • Index Cond: (id = m_1.location_dest_id)
37. 0.032 0.032 ↑ 1.0 1 8

Index Scan using stock_location_pkey on stock_location sl_source_1 (cost=0.06..0.11 rows=1 width=12) (actual time=0.004..0.004 rows=1 loops=8)

  • Index Cond: (id = m_1.location_id)
38. 0.072 0.072 ↑ 1.0 1 8

Index Only Scan using product_taxes_rel_prod_id_tax_id_key on product_taxes_rel pt_1 (cost=0.08..0.10 rows=1 width=8) (actual time=0.008..0.009 rows=1 loops=8)

  • Index Cond: (prod_id = m_1.product_id)
  • Heap Fetches: 0
39. 0.032 0.032 ↑ 1.0 1 8

Index Scan using account_tax_pkey on account_tax at_1 (cost=0.03..0.03 rows=1 width=8) (actual time=0.003..0.004 rows=1 loops=8)

  • Index Cond: (id = pt_1.tax_id)