explain.depesz.com

PostgreSQL's explain analyze made readable

Result: YGLM

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 16,078.772 ↓ 2.2 695,380 1

GroupAggregate (cost=898,328.57..1,022,320.59 rows=315,904 width=72) (actual time=12,040.872..16,078.772 rows=695,380 loops=1)

  • Sort Key: "*SELECT 1".move_id, "*SELECT 1".location_id, "*SELECT 1".company_id, "*SELECT 1".product_id, "*SELECT 1".product_categ_id, "*SELECT 1".date, "*SELECT 1".source, "*SELECT 1".product_template_id
  • Sort Method: external merge Disk: 208384kB
  • Hash Cond: (quant.lot_id = stock_production_lot.id)
  • Hash Cond: (stock_quant_move_rel.move_id = stock_move.id)
  • Merge Cond: (quant.id = stock_quant_move_rel.quant_id)
  • Filter: (qty > 0::double precision)
  • Rows Removed by Filter: 194
  • Buckets: 32768 Batches: 2 Memory Usage: 2326kB
  • Hash Cond: (stock_move.product_id = product_product.id)
  • Hash Cond: (stock_move.location_id = source_location.id)
  • Join Filter: ((source_location.company_id IS NOT NULL) OR (dest_location.company_id IS NOT NULL) OR (source_location.company_id <> dest_location.company_id) OR ((source_location.usage)::text <> ALL ('{inter (...)
  • Hash Cond: (stock_move.location_dest_id = dest_location.id)
  • Filter: ((state)::text = 'done'::text)
  • Rows Removed by Filter: 10577
  • Buckets: 1024 Batches: 1 Memory Usage: 5kB
  • Filter: ((usage)::text = ANY ('{internal,transit}'::text[]))
  • Rows Removed by Filter: 29
  • Buckets: 1024 Batches: 1 Memory Usage: 7kB
  • Buckets: 1024 Batches: 1 Memory Usage: 72kB
  • Hash Cond: (product_template.id = product_product.product_tmpl_id)
  • Buckets: 1024 Batches: 1 Memory Usage: 66kB
  • Buckets: 1024 Batches: 1 Memory Usage: 59kB
  • Hash Cond: (quant_1.lot_id = stock_production_lot_1.id)
  • Hash Cond: (stock_quant_move_rel_1.move_id = stock_move_1.id)
  • Merge Cond: (quant_1.id = stock_quant_move_rel_1.quant_id)
  • Filter: (qty > 0::double precision)
  • Rows Removed by Filter: 194
  • Buckets: 32768 Batches: 2 Memory Usage: 19632kB
  • Hash Cond: (stock_move_1.product_id = product_product_1.id)
  • Hash Cond: (stock_move_1.location_dest_id = dest_location_1.id)
  • Join Filter: ((dest_location_1.company_id IS NOT NULL) OR (source_location_1.company_id IS NOT NULL) OR (dest_location_1.company_id <> source_location_1.company_id) OR ((dest_location_1.usage)::text <> ALL (...)
  • Hash Cond: (stock_move_1.location_id = source_location_1.id)
  • Filter: ((state)::text = 'done'::text)
  • Rows Removed by Filter: 10577
  • Buckets: 1024 Batches: 1 Memory Usage: 5kB
  • Filter: ((usage)::text = ANY ('{internal,transit}'::text[]))
  • Rows Removed by Filter: 29
  • Buckets: 1024 Batches: 1 Memory Usage: 7kB
  • Buckets: 1024 Batches: 1 Memory Usage: 72kB
  • Hash Cond: (product_template_1.id = product_product_1.product_tmpl_id)
  • Buckets: 1024 Batches: 1 Memory Usage: 66kB
  • Buckets: 1024 Batches: 1 Memory Usage: 59kB
2. 13,135.551 13,135.551 ↑ 1.1 2,849,701 1

Sort (cost=898,328.57..906,226.15 rows=3,159,032 width=72) (actual time=12,040.848..13,135.551 rows=2,849,701 loops=1)

3. 7,678.470 7,678.470 ↑ 1.1 2,849,701 1

Append (cost=61,675.18..481,403.46 rows=3,159,032 width=72) (actual time=288.757..7,678.470 rows=2,849,701 loops=1)

4. 2,873.066 2,873.066 ↑ 1.1 1,426,758 1

Subquery Scan on *SELECT* 1 (cost=61,675.18..236,752.94 rows=1,579,516 width=72) (actual time=288.757..2,873.066 rows=1,426,758 loops=1)

5. 2,686.418 2,686.418 ↑ 1.1 1,426,758 1

Hash Left Join (cost=61,675.18..220,957.78 rows=1,579,516 width=68) (actual time=288.756..2,686.418 rows=1,426,758 loops=1)

6. 2,429.604 2,429.604 ↑ 1.1 1,426,758 1

Hash Join (cost=61,631.61..214,947.32 rows=1,579,516 width=63) (actual time=288.447..2,429.604 rows=1,426,758 loops=1)

7. 1,159.938 1,159.938 ↓ 1.0 2,021,846 1

Merge Join (cost=8.26..94,163.48 rows=2,021,245 width=24) (actual time=0.023..1,159.938 rows=2,021,846 loops=1)

8. 216.690 216.690 ↓ 1.0 592,223 1

Index Scan using stock_quant_pkey on stock_quant quant (cost=0.42..22,031.09 rows=592,184 width=24) (actual time=0.013..216.690 rows=592,223 loops=1)

9. 528.477 528.477 ↑ 1.0 2,022,040 1

Index Scan using stock_quant_move_rel_quant_id_idx on stock_quant_move_rel (cost=0.43..45,388.29 rows=2,022,040 width=8) (actual time=0.007..528.477 rows=2,022,040 loops=1)

10. 288.340 288.340 ↑ 7.1 72,692 1

Hash (cost=50,680.61..50,680.61 rows=513,979 width=43) (actual time=288.340..288.340 rows=72,692 loops=1)

11. 271.542 271.542 ↑ 7.1 72,692 1

Hash Join (cost=210.63..50,680.61 rows=513,979 width=43) (actual time=2.887..271.542 rows=72,692 loops=1)

12. 251.254 251.254 ↑ 7.1 72,692 1

Hash Join (cost=12.43..42,772.72 rows=513,979 width=35) (actual time=0.197..251.254 rows=72,692 loops=1)

13. 235.586 235.586 ↑ 7.1 72,692 1

Hash Join (cost=6.21..33,096.79 rows=515,718 width=39) (actual time=0.103..235.586 rows=72,692 loops=1)

14. 136.816 136.816 ↓ 1.0 647,142 1

Seq Scan on stock_move (cost=0.00..25,507.49 rows=646,910 width=35) (actual time=0.005..136.816 rows=647,142 loops=1)

15. 0.082 0.082 ↑ 1.0 114 1

Hash (cost=4.79..4.79 rows=114 width=8) (actual time=0.082..0.082 rows=114 loops=1)

16. 0.059 0.059 ↑ 1.0 114 1

Seq Scan on stock_location dest_location (cost=0.00..4.79 rows=114 width=8) (actual time=0.004..0.059 rows=114 loops=1)

17. 0.089 0.089 ↑ 1.0 143 1

Hash (cost=4.43..4.43 rows=143 width=16) (actual time=0.089..0.089 rows=143 loops=1)

18. 0.044 0.044 ↑ 1.0 143 1

Seq Scan on stock_location source_location (cost=0.00..4.43 rows=143 width=16) (actual time=0.005..0.044 rows=143 loops=1)

19. 2.686 2.686 ↑ 1.0 1,670 1

Hash (cost=177.32..177.32 rows=1,670 width=12) (actual time=2.686..2.686 rows=1,670 loops=1)

20. 2.354 2.354 ↑ 1.0 1,670 1

Hash Join (cost=57.58..177.32 rows=1,670 width=12) (actual time=0.809..2.354 rows=1,670 loops=1)

21. 0.301 0.301 ↑ 1.0 1,670 1

Seq Scan on product_template (cost=0.00..94.70 rows=1,670 width=8) (actual time=0.003..0.301 rows=1,670 loops=1)

22. 0.801 0.801 ↑ 1.0 1,670 1

Hash (cost=36.70..36.70 rows=1,670 width=8) (actual time=0.801..0.801 rows=1,670 loops=1)

23. 0.430 0.430 ↑ 1.0 1,670 1

Seq Scan on product_product (cost=0.00..36.70 rows=1,670 width=8) (actual time=0.005..0.430 rows=1,670 loops=1)

24. 0.302 0.302 ↑ 1.0 1,270 1

Hash (cost=27.70..27.70 rows=1,270 width=13) (actual time=0.302..0.302 rows=1,270 loops=1)

25. 0.165 0.165 ↑ 1.0 1,270 1

Seq Scan on stock_production_lot (cost=0.00..27.70 rows=1,270 width=13) (actual time=0.004..0.165 rows=1,270 loops=1)

26. 4,567.048 4,567.048 ↑ 1.1 1,422,943 1

Subquery Scan on *SELECT* 2 (cost=61,675.18..244,650.52 rows=1,579,516 width=72) (actual time=641.214..4,567.048 rows=1,422,943 loops=1)

27. 4,391.007 4,391.007 ↑ 1.1 1,422,943 1

Hash Left Join (cost=61,675.18..228,855.36 rows=1,579,516 width=68) (actual time=641.213..4,391.007 rows=1,422,943 loops=1)

28. 4,031.456 4,031.456 ↑ 1.1 1,422,943 1

Hash Join (cost=61,631.61..214,947.32 rows=1,579,516 width=63) (actual time=640.931..4,031.456 rows=1,422,943 loops=1)

29. 1,348.981 1,348.981 ↓ 1.0 2,021,846 1

Merge Join (cost=8.26..94,163.48 rows=2,021,245 width=24) (actual time=0.025..1,348.981 rows=2,021,846 loops=1)

30. 250.994 250.994 ↓ 1.0 592,223 1

Index Scan using stock_quant_pkey on stock_quant quant_1 (cost=0.42..22,031.09 rows=592,184 width=24) (actual time=0.016..250.994 rows=592,223 loops=1)

31. 623.008 623.008 ↑ 1.0 2,022,040 1

Index Scan using stock_quant_move_rel_quant_id_idx on stock_quant_move_rel stock_quant_move_rel_1 (cost=0.43..45,388.29 rows=2,022,040 width=8) (actual time=0.006..623.008 rows=2,022,040 loops=1)

32. 640.878 640.878 ↓ 1.2 623,495 1

Hash (cost=50,680.61..50,680.61 rows=513,979 width=43) (actual time=640.878..640.878 rows=623,495 loops=1)

33. 523.826 523.826 ↓ 1.2 623,495 1

Hash Join (cost=210.63..50,680.61 rows=513,979 width=43) (actual time=1.531..523.826 rows=623,495 loops=1)

34. 397.835 397.835 ↓ 1.2 623,495 1

Hash Join (cost=12.43..42,772.72 rows=513,979 width=35) (actual time=0.144..397.835 rows=623,495 loops=1)

35. 283.402 283.402 ↓ 1.2 623,495 1

Hash Join (cost=6.21..33,096.79 rows=515,718 width=39) (actual time=0.089..283.402 rows=623,495 loops=1)

36. 136.092 136.092 ↓ 1.0 647,142 1

Seq Scan on stock_move stock_move_1 (cost=0.00..25,507.49 rows=646,910 width=35) (actual time=0.004..136.092 rows=647,142 loops=1)

37. 0.079 0.079 ↑ 1.0 114 1

Hash (cost=4.79..4.79 rows=114 width=8) (actual time=0.079..0.079 rows=114 loops=1)

38. 0.058 0.058 ↑ 1.0 114 1

Seq Scan on stock_location source_location_1 (cost=0.00..4.79 rows=114 width=8) (actual time=0.004..0.058 rows=114 loops=1)

39. 0.051 0.051 ↑ 1.0 143 1

Hash (cost=4.43..4.43 rows=143 width=16) (actual time=0.051..0.051 rows=143 loops=1)

40. 0.024 0.024 ↑ 1.0 143 1

Seq Scan on stock_location dest_location_1 (cost=0.00..4.43 rows=143 width=16) (actual time=0.004..0.024 rows=143 loops=1)

41. 1.382 1.382 ↑ 1.0 1,670 1

Hash (cost=177.32..177.32 rows=1,670 width=12) (actual time=1.382..1.382 rows=1,670 loops=1)

42. 1.173 1.173 ↑ 1.0 1,670 1

Hash Join (cost=57.58..177.32 rows=1,670 width=12) (actual time=0.398..1.173 rows=1,670 loops=1)

43. 0.189 0.189 ↑ 1.0 1,670 1

Seq Scan on product_template product_template_1 (cost=0.00..94.70 rows=1,670 width=8) (actual time=0.003..0.189 rows=1,670 loops=1)

44. 0.392 0.392 ↑ 1.0 1,670 1

Hash (cost=36.70..36.70 rows=1,670 width=8) (actual time=0.392..0.392 rows=1,670 loops=1)

45. 0.206 0.206 ↑ 1.0 1,670 1

Seq Scan on product_product product_product_1 (cost=0.00..36.70 rows=1,670 width=8) (actual time=0.004..0.206 rows=1,670 loops=1)

46. 0.273 0.273 ↑ 1.0 1,270 1

Hash (cost=27.70..27.70 rows=1,270 width=13) (actual time=0.273..0.273 rows=1,270 loops=1)

47. 0.151 0.151 ↑ 1.0 1,270 1

Seq Scan on stock_production_lot stock_production_lot_1 (cost=0.00..27.70 rows=1,270 width=13) (actual time=0.003..0.151 rows=1,270 loops=1)