explain.depesz.com

PostgreSQL's explain analyze made readable

Result: IQsK

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

Group (cost=15,306.64..15,306.65 rows=1 width=8) (actual time=54,561.705..54,815.078 rows=566,319 loops=1)

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

Sort (cost=15,306.64..15,306.64 rows=1 width=8) (actual time=54,561.702..54,700.566 rows=1,489,741 loops=1)

  • Sort Key: ml1.id, ml2.id
  • Sort Method: quicksort Memory: 118984kB
3. 21,198.728 54,028.040 ↓ 1,489,741.0 1,489,741 1

Nested Loop (cost=6,638.66..15,306.63 rows=1 width=8) (actual time=45.173..54,028.040 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. 755.281 1,544.751 ↓ 1,489,741.0 1,489,741 1

Gather (cost=6,638.24..15,233.04 rows=1 width=16) (actual time=45.168..1,544.751 rows=1,489,741 loops=1)

  • Workers Planned: 1
  • Workers Launched: 1
5. 255.640 789.470 ↓ 744,870.0 744,870 2 / 2

Nested Loop (cost=5,638.24..14,232.94 rows=1 width=16) (actual time=39.830..789.470 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. 0.000 212.842 ↓ 495.3 13,374 2 / 2

Nested Loop (cost=5,637.82..12,246.02 rows=27 width=24) (actual time=39.810..212.842 rows=13,374 loops=2)

7. 12.839 160.813 ↓ 27.2 26,780 2 / 2

Nested Loop (cost=5,637.52..11,928.55 rows=985 width=20) (actual time=39.781..160.813 rows=26,780 loops=2)

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

Nested Loop (cost=5,637.10..11,312.96 rows=1,186 width=24) (actual time=39.764..121.225 rows=13,374 loops=2)

9. 2.700 93.808 ↓ 11.3 13,374 2 / 2

Nested Loop (cost=5,636.68..10,685.65 rows=1,186 width=16) (actual time=39.755..93.808 rows=13,374 loops=2)

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

Merge Join (cost=5,636.26..8,363.26 rows=4,888 width=20) (actual time=39.725..64.359 rows=13,374 loops=2)

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

Sort (cost=5,630.76..5,644.80 rows=5,617 width=12) (actual time=39.684..40.105 rows=3,374 loops=2)

  • Sort Key: sqmr1.quant_id
  • Sort Method: quicksort Memory: 2067kB
12. 14.537 34.507 ↓ 4.9 27,310 2 / 2

Hash Join (cost=916.21..5,280.95 rows=5,617 width=12) (actual time=9.273..34.507 rows=27,310 loops=2)

  • Hash Cond: (sqmr1.move_id = m1.id)
13. 14.419 14.419 ↑ 1.2 176,638 2 / 2

Parallel Seq Scan on stock_quant_move_rel sqmr1 (cost=0.00..3,796.11 rows=216,611 width=8) (actual time=0.031..14.419 rows=176,638 loops=2)

14. 0.282 5.551 ↑ 1.8 1,844 2 / 2

Hash (cost=875.35..875.35 rows=3,269 width=4) (actual time=5.551..5.551 rows=1,844 loops=2)

  • Buckets: 4096 Batches: 1 Memory Usage: 97kB
15. 5.269 5.269 ↑ 1.8 1,844 2 / 2

Index Scan using stock_move_raw_material_production_id_fkey_mig_10_0_idx on stock_move m1 (cost=0.29..875.35 rows=3,269 width=4) (actual time=0.135..5.269 rows=1,844 loops=2)

  • Index Cond: (raw_material_production_id IS NOT NULL)
16. 19.008 19.008 ↑ 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.023..19.008 rows=26,903 loops=2)

  • Index Cond: (consume_quant_id < 37000)
17. 26.749 26.749 ↑ 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.002..0.002 rows=1 loops=26,749)

  • Index Cond: (id = sqmr1.quant_id)
18. 26.749 26.749 ↑ 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.002..0.002 rows=1 loops=26,749)

  • Index Cond: (id = sqcr.produce_quant_id)
19. 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.002..0.002 rows=2 loops=26,749)

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

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

  • Index Cond: (id = sqmr2.move_id)
  • Filter: (production_id IS NOT NULL)
  • Rows Removed by Filter: 1
21. 320.988 320.988 ↑ 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.003..0.024 rows=103 loops=26,749)

  • Index Cond: (move_id = sqmr1.move_id)
22. 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 : 16.542 ms
Execution time : 54,832.209 ms