explain.depesz.com

PostgreSQL's explain analyze made readable

Result: itAb

Settings
# exclusive inclusive rows x rows loops node
1. 0.209 218.748 ↓ 1,748.0 1,748 1

Group (cost=8,865.17..8,865.18 rows=1 width=8) (actual time=218.478..218.748 rows=1,748 loops=1)

  • Group Key: ml1.id, ml2.id
2. 0.499 218.539 ↓ 1,748.0 1,748 1

Sort (cost=8,865.17..8,865.18 rows=1 width=8) (actual time=218.477..218.539 rows=1,748 loops=1)

  • Sort Key: ml1.id, ml2.id
  • Sort Method: quicksort Memory: 130kB
3. 35.909 218.040 ↓ 1,748.0 1,748 1

Nested Loop (cost=7,713.09..8,865.16 rows=1 width=8) (actual time=58.340..218.040 rows=1,748 loops=1)

  • Join Filter: ((ml2.lot_id IS NULL) OR (ml2.lot_id = q2.lot_id))
  • Rows Removed by Join Filter: 327148
4. 22.230 126.195 ↓ 1,748.0 1,748 1

Gather (cost=7,712.66..8,791.57 rows=1 width=16) (actual time=58.336..126.195 rows=1,748 loops=1)

  • Workers Planned: 1
  • Workers Launched: 1
5. 16.767 103.965 ↓ 874.0 874 2 / 2

Nested Loop (cost=6,712.66..7,791.47 rows=1 width=16) (actual time=52.287..103.965 rows=874 loops=2)

  • Join Filter: ((ml1.lot_id IS NULL) OR (ml1.lot_id = q1.lot_id))
  • Rows Removed by Join Filter: 164474
6. 0.677 65.348 ↓ 291.3 874 2 / 2

Nested Loop (cost=6,712.24..7,570.70 rows=3 width=24) (actual time=52.217..65.348 rows=874 loops=2)

  • Join Filter: (sqcr.produce_quant_id = q2.id)
7. 0.000 62.049 ↓ 72.8 874 2 / 2

Nested Loop (cost=6,711.82..7,565.00 rows=12 width=28) (actual time=52.197..62.049 rows=874 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)))
8. 0.751 58.645 ↓ 3.8 1,748 2 / 2

Nested Loop (cost=6,711.53..7,413.47 rows=456 width=32) (actual time=52.181..58.645 rows=1,748 loops=2)

9. 0.594 56.146 ↓ 6.5 874 2 / 2

Nested Loop (cost=6,711.10..7,308.89 rows=134 width=24) (actual time=52.162..56.146 rows=874 loops=2)

  • Join Filter: (sqcr.consume_quant_id = q1.id)
10. 0.401 52.930 ↓ 1.6 874 2 / 2

Merge Join (cost=6,710.68..7,047.09 rows=551 width=28) (actual time=52.142..52.930 rows=874 loops=2)

  • Merge Cond: (sqmr1.quant_id = sqcr.consume_quant_id)
11. 6.354 52.186 ↑ 6.4 875 2 / 2

Sort (cost=6,705.19..6,719.23 rows=5,617 width=20) (actual time=52.106..52.186 rows=875 loops=2)

  • Sort Key: sqmr1.quant_id
  • Sort Method: quicksort Memory: 2233kB
12. 3.909 45.832 ↓ 4.9 27,310 2 / 2

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

13. 1.097 1.355 ↑ 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.871..1.355 rows=922 loops=2)

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

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

15. 0.256 0.256 ↓ 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.512..0.512 rows=3,688 loops=1)

  • Index Cond: (raw_material_production_id IS NOT NULL)
16. 0.002 0.002 ↓ 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.003..0.003 rows=0 loops=1)

  • Index Cond: (consume_unbuild_id IS NOT NULL)
17. 40.568 40.568 ↓ 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.032..0.044 rows=30 loops=1,844)

  • Index Cond: (move_id = m1.id)
18. 0.343 0.343 ↑ 6.0 1,748 2 / 2

Index Scan using sqcr_consume_quant_id_idx on stock_quant_consume_rel sqcr (cost=0.43..281.96 rows=10,553 width=8) (actual time=0.028..0.343 rows=1,748 loops=2)

  • Index Cond: (consume_quant_id < 15000)
19. 2.622 2.622 ↑ 1.0 1 1,748 / 2

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

  • Index Cond: (id = sqmr1.quant_id)
20. 1.748 1.748 ↑ 1.5 2 1,748 / 2

Index Scan using sqmr_quant_id_idx on stock_quant_move_rel sqmr2 (cost=0.42..0.75 rows=3 width=8) (actual time=0.002..0.002 rows=2 loops=1,748)

  • Index Cond: (quant_id = sqcr.produce_quant_id)
21. 3.496 3.496 ↓ 0.0 0 3,496 / 2

Index Scan using stock_move_pkey on stock_move m2 (cost=0.29..0.32 rows=1 width=12) (actual time=0.002..0.002 rows=0 loops=3,496)

  • Index Cond: (id = sqmr2.move_id)
  • Filter: ((production_id IS NOT NULL) OR (unbuild_id IS NOT NULL))
  • Rows Removed by Filter: 0
22. 2.622 2.622 ↑ 1.0 1 1,748 / 2

Index Scan using stock_quant_pkey on stock_quant q2 (cost=0.42..0.46 rows=1 width=8) (actual time=0.003..0.003 rows=1 loops=1,748)

  • Index Cond: (id = sqmr2.quant_id)
23. 21.850 21.850 ↑ 12.9 189 1,748 / 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.004..0.025 rows=189 loops=1,748)

  • Index Cond: (move_id = sqmr1.move_id)
24. 55.936 55.936 ↑ 13.0 188 1,748

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.003..0.032 rows=188 loops=1,748)

  • Index Cond: (move_id = sqmr2.move_id)
Planning time : 13.856 ms