explain.depesz.com

PostgreSQL's explain analyze made readable

Result: yFHi

Settings
# exclusive inclusive rows x rows loops node
1. 17.796 94.812 ↓ 0.0 0 1

Insert on stock_move_line_consume_rel (cost=23,803.08..25,838.26 rows=101,759 width=8) (actual time=94.812..94.812 rows=0 loops=1)

2. 0.242 77.016 ↑ 30.8 3,300 1

Subquery Scan on *SELECT* (cost=23,803.08..25,838.26 rows=101,759 width=8) (actual time=75.822..77.016 rows=3,300 loops=1)

3. 1.665 76.774 ↑ 30.8 3,300 1

HashAggregate (cost=23,803.08..24,820.67 rows=101,759 width=8) (actual time=75.821..76.774 rows=3,300 loops=1)

  • Group Key: sml1.id, sml2.id
4. 44.589 75.109 ↑ 30.8 3,300 1

Hash Join (cost=10,904.94..23,294.29 rows=101,759 width=8) (actual time=54.205..75.109 rows=3,300 loops=1)

  • Hash Cond: (sml1.move_id = sm1.id)
5. 29.954 29.954 ↑ 1.0 303,990 1

Seq Scan on stock_move_line sml1 (cost=0.00..10,231.90 rows=303,990 width=8) (actual time=0.036..29.954 rows=303,990 loops=1)

6. 0.060 0.566 ↑ 184.3 240 1

Hash (cost=10,351.89..10,351.89 rows=44,244 width=8) (actual time=0.566..0.566 rows=240 loops=1)

  • Buckets: 65536 Batches: 1 Memory Usage: 522kB
7. 0.189 0.506 ↑ 184.3 240 1

Merge Join (cost=1.29..10,351.89 rows=44,244 width=8) (actual time=0.073..0.506 rows=240 loops=1)

  • Merge Cond: (mp.id = sm1.raw_material_production_id)
8. 0.021 0.176 ↑ 6.1 90 1

Nested Loop (cost=0.99..10,162.77 rows=552 width=12) (actual time=0.056..0.176 rows=90 loops=1)

9. 0.010 0.041 ↑ 40.0 6 1

Nested Loop (cost=0.57..11.66 rows=240 width=12) (actual time=0.022..0.041 rows=6 loops=1)

10. 0.013 0.013 ↑ 1.0 3 1

Index Scan using mrp_production_pkey on mrp_production mp (cost=0.28..2.91 rows=3 width=4) (actual time=0.011..0.013 rows=3 loops=1)

  • Index Cond: (id < 5)
  • Filter: ((state)::text = 'done'::text)
  • Rows Removed by Filter: 1
11. 0.018 0.018 ↑ 1.0 2 3

Index Scan using stock_move_production_id_fkey_mig_10_0_idx on stock_move sm2 (cost=0.29..2.90 rows=2 width=8) (actual time=0.004..0.006 rows=2 loops=3)

  • Index Cond: (production_id = mp.id)
12. 0.114 0.114 ↑ 101.3 15 6

Index Scan using stock_move_line_move_id_index on stock_move_line sml2 (cost=0.42..27.10 rows=1,520 width=8) (actual time=0.012..0.019 rows=15 loops=6)

  • Index Cond: (move_id = sm2.id)
13. 0.141 0.141 ↑ 546.2 242 1

Index Scan using stock_move_raw_material_production_id_fkey_mig_10_0_idx on stock_move sm1 (cost=0.29..6,238.53 rows=132,187 width=8) (actual time=0.010..0.141 rows=242 loops=1)

Planning time : 2.169 ms
Execution time : 138.316 ms
Trigger times:
Trigger Name:Total time:Calls:Average time:
for constraint stock_move_line_consume_rel_consume_line_id_fkey 21.415 ms 3300 0.006 ms
for constraint stock_move_line_consume_rel_produce_line_id_fkey 21.159 ms 3300 0.006 ms