explain.depesz.com

PostgreSQL's explain analyze made readable

Result: vssn

Settings
# exclusive inclusive rows x rows loops node
1. 2.848 3.978 ↓ 0.0 0 1

Insert on stock_move_line_consume_rel (cost=17.51..21.35 rows=192 width=8) (actual time=3.978..3.978 rows=0 loops=1)

2. 0.059 1.130 ↑ 1.1 167 1

Subquery Scan on *SELECT* (cost=17.51..21.35 rows=192 width=8) (actual time=0.986..1.130 rows=167 loops=1)

3. 0.236 1.071 ↑ 1.1 167 1

HashAggregate (cost=17.51..19.43 rows=192 width=8) (actual time=0.985..1.071 rows=167 loops=1)

  • Group Key: sml1.id, sml2.id
4. 0.095 0.835 ↑ 1.1 167 1

Merge Join (cost=12.82..16.55 rows=192 width=8) (actual time=0.487..0.835 rows=167 loops=1)

  • Merge Cond: (sm1.raw_material_production_id = mp.id)
5. 0.115 0.692 ↓ 4.9 177 1

Merge Join (cost=11.61..20.87 rows=36 width=16) (actual time=0.432..0.692 rows=177 loops=1)

  • Merge Cond: (sm2.production_id = sm1.raw_material_production_id)
6. 0.048 0.173 ↑ 3.0 21 1

Nested Loop (cost=0.28..44.50 rows=62 width=8) (actual time=0.055..0.173 rows=21 loops=1)

7. 0.040 0.040 ↑ 4.4 17 1

Index Scan using sm_production_id_idx on stock_move sm2 (cost=0.14..19.93 rows=75 width=8) (actual time=0.019..0.040 rows=17 loops=1)

8. 0.085 0.085 ↑ 1.0 1 17

Index Scan using stock_move_line_move_id_index on stock_move_line sml2 (cost=0.14..0.32 rows=1 width=8) (actual time=0.004..0.005 rows=1 loops=17)

  • Index Cond: (move_id = sm2.id)
9. 0.104 0.404 ↓ 2.9 178 1

Sort (cost=11.33..11.48 rows=62 width=8) (actual time=0.371..0.404 rows=178 loops=1)

  • Sort Key: sm1.raw_material_production_id
  • Sort Method: quicksort Memory: 27kB
10. 0.102 0.300 ↑ 1.0 62 1

Hash Join (cost=7.69..9.48 rows=62 width=8) (actual time=0.220..0.300 rows=62 loops=1)

  • Hash Cond: (sml1.move_id = sm1.id)
11. 0.031 0.031 ↑ 1.0 62 1

Seq Scan on stock_move_line sml1 (cost=0.00..1.62 rows=62 width=8) (actual time=0.017..0.031 rows=62 loops=1)

12. 0.053 0.167 ↑ 1.0 75 1

Hash (cost=6.75..6.75 rows=75 width=8) (actual time=0.166..0.167 rows=75 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 11kB
13. 0.114 0.114 ↑ 1.0 75 1

Seq Scan on stock_move sm1 (cost=0.00..6.75 rows=75 width=8) (actual time=0.010..0.114 rows=75 loops=1)

14. 0.024 0.048 ↑ 1.0 5 1

Sort (cost=1.21..1.22 rows=5 width=4) (actual time=0.047..0.048 rows=5 loops=1)

  • Sort Key: mp.id
  • Sort Method: quicksort Memory: 25kB
15. 0.024 0.024 ↑ 1.0 5 1

Seq Scan on mrp_production mp (cost=0.00..1.15 rows=5 width=4) (actual time=0.017..0.024 rows=5 loops=1)

  • Filter: ((id < 100) AND ((state)::text = 'done'::text))
  • Rows Removed by Filter: 5
Planning time : 7.856 ms
Execution time : 18.214 ms
Trigger times:
Trigger Name:Total time:Calls:Average time:
for constraint stock_move_line_consume_rel_consume_line_id_fkey 7.017 ms 167 0.042 ms
for constraint stock_move_line_consume_rel_produce_line_id_fkey 6.496 ms 167 0.039 ms