explain.depesz.com

PostgreSQL's explain analyze made readable

Result: ee1F

Settings
# exclusive inclusive rows x rows loops node
1. 2,495.942 11,968.021 ↑ 1.1 6,412,398 1

Hash Join (cost=386,290.01..822,045.73 rows=6,936,055 width=4) (actual time=2,199.947..11,968.021 rows=6,412,398 loops=1)

  • Output: stock_move.id
  • Inner Unique: true
  • Hash Cond: (stock_quant_move_rel.quant_id = quant.id)
  • Functions: 55
  • Options: Inlining true, Optimization true, Expressions true, Deforming true
  • Timing: Generation 4.148 ms, Inlining 4.445 ms, Optimization 232.152 ms, Emission 162.829 ms, Total 403.573 ms
2. 871.274 8,390.346 ↑ 1.1 6,412,412 1

Hash Join (cost=226,866.03..576,151.70 rows=6,937,536 width=8) (actual time=1,117.507..8,390.346 rows=6,412,412 loops=1)

  • Output: stock_move.id, stock_quant_move_rel.quant_id
  • Inner Unique: true
  • Hash Cond: (product_product.product_tmpl_id = product_template.id)
3. 913.125 7,506.998 ↑ 1.1 6,412,412 1

Hash Join (cost=223,958.29..555,031.67 rows=6,937,536 width=12) (actual time=1,105.236..7,506.998 rows=6,412,412 loops=1)

  • Output: stock_move.id, stock_quant_move_rel.quant_id, product_product.product_tmpl_id
  • Inner Unique: true
  • Hash Cond: (stock_move.product_id = product_product.id)
4. 736.208 6,579.391 ↑ 1.1 6,412,412 1

Hash Join (cost=221,524.70..534,385.79 rows=6,937,536 width=12) (actual time=1,090.556..6,579.391 rows=6,412,412 loops=1)

  • Output: stock_move.id, stock_move.product_id, stock_quant_move_rel.quant_id
  • Inner Unique: true
  • Hash Cond: (stock_move.location_id = source_location.id)
  • Join Filter: ((source_location.company_id IS NOT NULL) OR (dest_location.company_id IS NOT NULL) OR (source_location.company_id <> dest_location.company_id) OR ((source_location.usage)::text <> ALL ('{internal,transit}'::text[])))
5. 890.486 5,843.151 ↑ 1.1 6,412,412 1

Hash Join (cost=221,521.37..513,994.36 rows=7,036,792 width=20) (actual time=1,090.512..5,843.151 rows=6,412,412 loops=1)

  • Output: stock_move.id, stock_move.location_id, stock_move.product_id, stock_quant_move_rel.quant_id, dest_location.company_id
  • Inner Unique: true
  • Hash Cond: (stock_move.location_dest_id = dest_location.id)
6. 3,196.536 4,952.646 ↓ 1.0 9,914,762 1

Hash Join (cost=221,518.11..486,179.02 rows=9,885,017 width=20) (actual time=1,090.488..4,952.646 rows=9,914,762 loops=1)

  • Output: stock_move.id, stock_move.location_dest_id, stock_move.location_id, stock_move.product_id, stock_quant_move_rel.quant_id
  • Inner Unique: true
  • Hash Cond: (stock_quant_move_rel.move_id = stock_move.id)
7. 666.516 666.516 ↑ 1.0 9,914,762 1

Seq Scan on public.stock_quant_move_rel (cost=0.00..143,018.62 rows=9,914,762 width=8) (actual time=0.007..666.516 rows=9,914,762 loops=1)

  • Output: stock_quant_move_rel.move_id, stock_quant_move_rel.quant_id
8. 523.769 1,089.594 ↑ 1.0 3,717,602 1

Hash (cost=156,882.99..156,882.99 rows=3,718,330 width=16) (actual time=1,089.594..1,089.594 rows=3,717,602 loops=1)

  • Output: stock_move.id, stock_move.location_dest_id, stock_move.location_id, stock_move.product_id
  • Buckets: 262144 Batches: 32 Memory Usage: 7490kB
9. 565.825 565.825 ↑ 1.0 3,717,602 1

Seq Scan on public.stock_move (cost=0.00..156,882.99 rows=3,718,330 width=16) (actual time=0.008..565.825 rows=3,717,602 loops=1)

  • Output: stock_move.id, stock_move.location_dest_id, stock_move.location_id, stock_move.product_id
  • Filter: ((stock_move.state)::text = 'done'::text)
  • Rows Removed by Filter: 11917
10. 0.006 0.019 ↑ 1.0 42 1

Hash (cost=2.74..2.74 rows=42 width=8) (actual time=0.019..0.019 rows=42 loops=1)

  • Output: dest_location.id, dest_location.company_id
  • Buckets: 1024 Batches: 1 Memory Usage: 10kB
11. 0.013 0.013 ↑ 1.0 42 1

Seq Scan on public.stock_location dest_location (cost=0.00..2.74 rows=42 width=8) (actual time=0.007..0.013 rows=42 loops=1)

  • Output: dest_location.id, dest_location.company_id
  • Filter: ((dest_location.usage)::text = ANY ('{internal,transit}'::text[]))
  • Rows Removed by Filter: 17
12. 0.010 0.032 ↑ 1.0 59 1

Hash (cost=2.59..2.59 rows=59 width=16) (actual time=0.032..0.032 rows=59 loops=1)

  • Output: source_location.id, source_location.company_id, source_location.usage
  • Buckets: 1024 Batches: 1 Memory Usage: 11kB
13. 0.022 0.022 ↑ 1.0 59 1

Seq Scan on public.stock_location source_location (cost=0.00..2.59 rows=59 width=16) (actual time=0.017..0.022 rows=59 loops=1)

  • Output: source_location.id, source_location.company_id, source_location.usage
14. 8.470 14.482 ↑ 1.0 61,493 1

Hash (cost=1,664.93..1,664.93 rows=61,493 width=8) (actual time=14.482..14.482 rows=61,493 loops=1)

  • Output: product_product.id, product_product.product_tmpl_id
  • Buckets: 65536 Batches: 1 Memory Usage: 2915kB
15. 6.012 6.012 ↑ 1.0 61,493 1

Seq Scan on public.product_product (cost=0.00..1,664.93 rows=61,493 width=8) (actual time=0.014..6.012 rows=61,493 loops=1)

  • Output: product_product.id, product_product.product_tmpl_id
16. 6.817 12.074 ↑ 1.0 61,366 1

Hash (cost=2,140.66..2,140.66 rows=61,366 width=4) (actual time=12.074..12.074 rows=61,366 loops=1)

  • Output: product_template.id
  • Buckets: 65536 Batches: 1 Memory Usage: 2670kB
17. 5.257 5.257 ↑ 1.0 61,366 1

Seq Scan on public.product_template (cost=0.00..2,140.66 rows=61,366 width=4) (actual time=0.014..5.257 rows=61,366 loops=1)

  • Output: product_template.id
18. 374.440 1,081.733 ↓ 1.0 3,599,040 1

Hash (cost=100,377.79..100,377.79 rows=3,598,975 width=4) (actual time=1,081.733..1,081.733 rows=3,599,040 loops=1)

  • Output: quant.id
  • Buckets: 262144 Batches: 32 Memory Usage: 5996kB
19. 707.293 707.293 ↓ 1.0 3,599,040 1

Seq Scan on public.stock_quant quant (cost=0.00..100,377.79 rows=3,598,975 width=4) (actual time=400.030..707.293 rows=3,599,040 loops=1)

  • Output: quant.id
  • Filter: (quant.qty > '0'::double precision)
  • Rows Removed by Filter: 703
Execution time : 12,116.957 ms