explain.depesz.com

PostgreSQL's explain analyze made readable

Result: SomC

Settings
# exclusive inclusive rows x rows loops node
1. 114.489 54,599.912 ↓ 566,319.0 566,319 1

Group (cost=16,390.91..16,390.92 rows=1 width=8) (actual time=54,348.263..54,599.912 rows=566,319 loops=1)

  • Group Key: ml1.id, ml2.id
2. 639.662 54,485.423 ↓ 1,489,741.0 1,489,741 1

Sort (cost=16,390.91..16,390.92 rows=1 width=8) (actual time=54,348.261..54,485.423 rows=1,489,741 loops=1)

  • Sort Key: ml1.id, ml2.id
  • Sort Method: quicksort Memory: 118984kB
3. 21,531.967 53,845.761 ↓ 1,489,741.0 1,489,741 1

Nested Loop (cost=7,713.09..16,390.90 rows=1 width=8) (actual time=35.472..53,845.761 rows=1,489,741 loops=1)

  • Join Filter: ((ml2.lot_id IS NULL) OR (ml2.lot_id = q2.lot_id))
  • Rows Removed by Join Filter: 216413876
4. 475.777 1,029.233 ↓ 1,489,741.0 1,489,741 1

Gather (cost=7,712.66..16,317.31 rows=1 width=16) (actual time=35.468..1,029.233 rows=1,489,741 loops=1)

  • Workers Planned: 1
  • Workers Launched: 1
5. 198.943 553.456 ↓ 744,870.0 744,870 2 / 2

Nested Loop (cost=6,712.66..15,317.21 rows=1 width=16) (actual time=26.362..553.456 rows=744,870 loops=2)

  • Join Filter: ((ml1.lot_id IS NULL) OR (ml1.lot_id = q1.lot_id))
  • Rows Removed by Join Filter: 628598
6. 15.446 167.270 ↓ 495.3 13,374 2 / 2

Nested Loop (cost=6,712.24..13,330.30 rows=27 width=24) (actual time=26.296..167.270 rows=13,374 loops=2)

  • Join Filter: (((m1.raw_material_production_id IS NOT NULL) AND (m2.production_id IS NOT NULL)) OR ((m1.consume_unbuild_id IS NOT NULL) AND (m2.unbuild_id IS NOT NULL)))
7. 5.863 125.045 ↓ 27.2 26,780 2 / 2

Nested Loop (cost=6,711.95..13,002.98 rows=985 width=28) (actual time=26.224..125.045 rows=26,780 loops=2)

  • Join Filter: (sqcr.produce_quant_id = sqmr2.quant_id)
8. 10.485 92.433 ↓ 11.3 13,374 2 / 2

Nested Loop (cost=6,711.53..12,387.38 rows=1,186 width=32) (actual time=26.167..92.433 rows=13,374 loops=2)

9. 12.234 68.574 ↓ 11.3 13,374 2 / 2

Nested Loop (cost=6,711.10..11,760.08 rows=1,186 width=24) (actual time=26.161..68.574 rows=13,374 loops=2)

  • Join Filter: (sqcr.consume_quant_id = q1.id)
10. 4.479 42.965 ↓ 2.7 13,374 2 / 2

Merge Join (cost=6,710.68..9,437.68 rows=4,888 width=28) (actual time=25.806..42.965 rows=13,374 loops=2)

  • Merge Cond: (sqmr1.quant_id = sqcr.consume_quant_id)
11. 5.505 26.033 ↑ 1.7 3,374 2 / 2

Sort (cost=6,705.19..6,719.23 rows=5,617 width=20) (actual time=25.637..26.033 rows=3,374 loops=2)

  • Sort Key: sqmr1.quant_id
  • Sort Method: quicksort Memory: 3323kB
12. 2.190 20.528 ↓ 4.9 27,310 2 / 2

Nested Loop (cost=39.39..6,355.37 rows=5,617 width=20) (actual time=0.833..20.528 rows=27,310 loops=2)

13. 0.650 0.820 ↑ 2.1 922 2 / 2

Parallel Bitmap Heap Scan on stock_move m1 (cost=38.97..2,378.79 rows=1,923 width=12) (actual time=0.558..0.820 rows=922 loops=2)

  • Recheck Cond: ((raw_material_production_id IS NOT NULL) OR (consume_unbuild_id IS NOT NULL))
  • Heap Blocks: exact=945
14. 0.001 0.170 ↓ 0.0 0 1 / 2

BitmapOr (cost=38.97..38.97 rows=3,269 width=0) (actual time=0.339..0.339 rows=0 loops=1)

15. 0.168 0.168 ↓ 1.1 3,688 1 / 2

Bitmap Index Scan on sm_raw_material_production_id_idx (cost=0.00..35.93 rows=3,269 width=0) (actual time=0.336..0.336 rows=3,688 loops=1)

  • Index Cond: (raw_material_production_id IS NOT NULL)
16. 0.001 0.001 ↓ 0.0 0 1 / 2

Bitmap Index Scan on stock_move_consume_unbuild_id_fkey_mig_10_0_idx (cost=0.00..1.40 rows=1 width=0) (actual time=0.002..0.002 rows=0 loops=1)

  • Index Cond: (consume_unbuild_id IS NOT NULL)
17. 17.518 17.518 ↓ 1.2 30 1,844 / 2

Index Scan using stock_quant_move_rel_move_id_idx on stock_quant_move_rel sqmr1 (cost=0.42..1.81 rows=26 width=8) (actual time=0.013..0.019 rows=30 loops=1,844)

  • Index Cond: (move_id = m1.id)
18. 12.453 12.453 ↑ 3.5 26,903 2 / 2

Index Scan using sqcr_consume_quant_id_idx on stock_quant_consume_rel sqcr (cost=0.43..2,421.36 rows=93,681 width=8) (actual time=0.146..12.453 rows=26,903 loops=2)

  • Index Cond: (consume_quant_id < 37000)
19. 13.375 13.375 ↑ 1.0 1 26,749 / 2

Index Scan using stock_quant_pkey on stock_quant q1 (cost=0.42..0.46 rows=1 width=8) (actual time=0.001..0.001 rows=1 loops=26,749)

  • Index Cond: (id = sqmr1.quant_id)
20. 13.375 13.375 ↑ 1.0 1 26,749 / 2

Index Scan using stock_quant_pkey on stock_quant q2 (cost=0.42..0.53 rows=1 width=8) (actual time=0.001..0.001 rows=1 loops=26,749)

  • Index Cond: (id = sqcr.produce_quant_id)
21. 26.749 26.749 ↑ 1.5 2 26,749 / 2

Index Scan using sqmr_quant_id_idx on stock_quant_move_rel sqmr2 (cost=0.42..0.48 rows=3 width=8) (actual time=0.001..0.002 rows=2 loops=26,749)

  • Index Cond: (quant_id = q2.id)
22. 26.780 26.780 ↓ 0.0 0 53,559 / 2

Index Scan using stock_move_pkey on stock_move m2 (cost=0.29..0.32 rows=1 width=12) (actual time=0.001..0.001 rows=0 loops=53,559)

  • Index Cond: (id = sqmr2.move_id)
  • Filter: ((production_id IS NOT NULL) OR (unbuild_id IS NOT NULL))
  • Rows Removed by Filter: 1
23. 187.243 187.243 ↑ 23.7 103 26,749 / 2

Index Scan using stock_move_line_move_id_index on stock_move_line ml1 (cost=0.42..43.11 rows=2,438 width=12) (actual time=0.002..0.014 rows=103 loops=26,749)

  • Index Cond: (move_id = sqmr1.move_id)
24. 31,284.561 31,284.561 ↑ 16.7 146 1,489,741

Index Scan using stock_move_line_move_id_index on stock_move_line ml2 (cost=0.42..43.11 rows=2,438 width=12) (actual time=0.002..0.021 rows=146 loops=1,489,741)

  • Index Cond: (move_id = sqmr2.move_id)
Planning time : 22.007 ms
Execution time : 54,612.174 ms