explain.depesz.com

PostgreSQL's explain analyze made readable

Result: jvmQ

Settings
# exclusive inclusive rows x rows loops node
1. 63.144 16,108.895 ↓ 24,351.0 24,351 1

Group (cost=18,263.06..18,263.07 rows=1 width=8) (actual time=15,967.847..16,108.895 rows=24,351 loops=1)

  • Group Key: sml1.id, sml2.id
2. 320.238 16,045.751 ↓ 945,059.0 945,059 1

Sort (cost=18,263.06..18,263.07 rows=1 width=8) (actual time=15,967.844..16,045.751 rows=945,059 loops=1)

  • Sort Key: sml1.id, sml2.id
  • Sort Method: quicksort Memory: 68876kB
3. 5,849.182 15,725.513 ↓ 945,059.0 945,059 1

Nested Loop (cost=4,706.47..18,263.05 rows=1 width=8) (actual time=1,276.354..15,725.513 rows=945,059 loops=1)

  • Join Filter: (NOT (sml2.lot_id IS DISTINCT FROM sq2.lot_id))
  • Rows Removed by Join Filter: 56300716
4. 0.000 1,370.800 ↓ 945,059.0 945,059 1

Gather (cost=4,706.05..18,217.00 rows=1 width=16) (actual time=1,276.319..1,370.800 rows=945,059 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
5. 179.803 1,445.784 ↓ 315,020.0 315,020 3 / 3

Parallel Hash Join (cost=3,706.05..17,216.90 rows=1 width=16) (actual time=1,269.861..1,445.784 rows=315,020 loops=3)

  • Hash Cond: (sml1.move_id = sqmr1.move_id)
  • Join Filter: (NOT (sml1.lot_id IS DISTINCT FROM sq1.lot_id))
  • Rows Removed by Join Filter: 389453
6. 21.479 21.479 ↑ 1.2 101,330 3 / 3

Parallel Seq Scan on stock_move_line sml1 (cost=0.00..8,471.62 rows=126,662 width=12) (actual time=3.480..21.479 rows=101,330 loops=3)

7. 644.703 1,244.502 ↓ 6.8 8,117 3 / 3

Parallel Hash (cost=3,691.11..3,691.11 rows=1,195 width=24) (actual time=1,244.502..1,244.502 rows=8,117 loops=3)

  • Buckets: 32768 (originally 4096) Batches: 1 (originally 1) Memory Usage: 1824kB
8. 5.214 599.799 ↓ 6.8 8,117 3 / 3

Nested Loop (cost=3.19..3,691.11 rows=1,195 width=24) (actual time=1.711..599.799 rows=8,117 loops=3)

  • Join Filter: (sqmr2.quant_id = sq2.id)
9. 1.374 586.468 ↓ 3.3 8,117 3 / 3

Merge Join (cost=2.77..2,594.24 rows=2,433 width=28) (actual time=1.703..586.468 rows=8,117 loops=3)

  • Merge Cond: (sm1.raw_material_production_id = mp.id)
10. 5.454 584.916 ↓ 811.8 8,118 3 / 3

Nested Loop (cost=2.49..25,700.37 rows=10 width=36) (actual time=1.577..584.916 rows=8,118 loops=3)

  • Join Filter: (sqmr1.quant_id = sq1.id)
11. 78.611 571.344 ↓ 405.9 8,118 3 / 3

Nested Loop (cost=2.07..25,691.36 rows=20 width=40) (actual time=1.537..571.344 rows=8,118 loops=3)

12. 34.645 86.824 ↓ 17.2 405,909 3 / 3

Nested Loop (cost=1.63..9,854.02 rows=23,641 width=32) (actual time=1.405..86.824 rows=405,909 loops=3)

13. 0.366 3.242 ↑ 1.2 2,879 3 / 3

Nested Loop (cost=1.21..5,611.48 rows=3,558 width=24) (actual time=1.398..3.242 rows=2,879 loops=3)

14. 0.244 2.069 ↑ 3.3 161 3 / 3

Merge Join (cost=0.79..4,973.55 rows=535 width=16) (actual time=1.362..2.069 rows=161 loops=3)

  • Merge Cond: (sm1.raw_material_production_id = sm2.production_id)
15. 0.201 0.201 ↑ 211.8 109 3 / 3

Parallel Index Scan using stock_move_raw_material_production_id_fkey_mig_10_0_idx on stock_move sm1 (cost=0.29..4,775.45 rows=23,085 width=8) (actual time=0.049..0.201 rows=109 loops=3)

16. 1.624 1.624 ↑ 120.2 461 3 / 3

Index Scan using stock_move_production_id_fkey_mig_10_0_idx on stock_move sm2 (cost=0.29..5,104.38 rows=55,405 width=8) (actual time=0.031..1.624 rows=461 loops=3)

17. 0.807 0.807 ↑ 1.4 18 484 / 3

Index Scan using stock_quant_move_rel_move_id_idx on stock_quant_move_rel sqmr1 (cost=0.42..0.93 rows=26 width=8) (actual time=0.003..0.005 rows=18 loops=484)

  • Index Cond: (move_id = sm1.id)
18. 48.937 48.937 ↓ 5.4 141 8,636 / 3

Index Scan using stock_quant_move_rel_move_id_idx on stock_quant_move_rel sqmr2 (cost=0.42..0.93 rows=26 width=8) (actual time=0.002..0.017 rows=141 loops=8,636)

  • Index Cond: (move_id = sm2.id)
19. 405.909 405.909 ↓ 0.0 0 1,217,727 / 3

Index Only Scan using stock_quant_consume_rel_consume_quant_id_produce_quant_id_key on stock_quant_consume_rel sqcr (cost=0.43..0.67 rows=1 width=8) (actual time=0.001..0.001 rows=0 loops=1,217,727)

  • Index Cond: ((consume_quant_id = sqmr1.quant_id) AND (produce_quant_id = sqmr2.quant_id))
  • Heap Fetches: 24354
20. 8.118 8.118 ↑ 1.0 1 24,354 / 3

Index Scan using stock_quant_pkey on stock_quant sq1 (cost=0.42..0.44 rows=1 width=8) (actual time=0.001..0.001 rows=1 loops=24,354)

  • Index Cond: (id = sqcr.consume_quant_id)
21. 0.178 0.178 ↓ 1.0 283 3 / 3

Index Only Scan using mrp_production_pkey on mrp_production mp (cost=0.28..21.25 rows=282 width=4) (actual time=0.035..0.178 rows=283 loops=3)

  • Index Cond: (id < 300)
  • Heap Fetches: 849
22. 8.117 8.117 ↑ 1.0 1 24,351 / 3

Index Scan using stock_quant_pkey on stock_quant sq2 (cost=0.42..0.44 rows=1 width=8) (actual time=0.001..0.001 rows=1 loops=24,351)

  • Index Cond: (id = sqcr.produce_quant_id)
23. 8,505.531 8,505.531 ↑ 24.9 61 945,059

Index Scan using stock_move_line_move_id_index on stock_move_line sml2 (cost=0.42..27.05 rows=1,520 width=12) (actual time=0.002..0.009 rows=61 loops=945,059)

  • Index Cond: (move_id = sqmr2.move_id)
Planning time : 19.787 ms
Execution time : 16,113.867 ms