explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 2Who

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

GroupAggregate (cost=762,673.69..886,665.71 rows=315,904 width=72) (actual time=11,543.735..15,963.467 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: 208,408kB
  • Hash Cond: (stock_quant_move_rel.quant_id = quant.id)
  • Hash Cond: (stock_quant_move_rel.move_id = stock_move.id)
  • Buckets: 65,536 Batches: 1 Memory Usage: 4,626kB
  • 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: 10,577
  • Buckets: 1,024 Batches: 1 Memory Usage: 5kB
  • Filter: ((usage)::text = ANY ('{internal,transit}'::text[]))
  • Rows Removed by Filter: 29
  • Buckets: 1,024 Batches: 1 Memory Usage: 7kB
  • Buckets: 1,024 Batches: 1 Memory Usage: 72kB
  • Hash Cond: (product_template.id = product_product.product_tmpl_id)
  • Buckets: 1,024 Batches: 1 Memory Usage: 66kB
  • Buckets: 65,536 Batches: 1 Memory Usage: 30,090kB
  • Hash Cond: (quant.lot_id = stock_production_lot.id)
  • Filter: (qty > 0::double precision)
  • Rows Removed by Filter: 194
  • Buckets: 1,024 Batches: 1 Memory Usage: 59kB
  • Hash Cond: (stock_quant_move_rel_1.quant_id = quant_1.id)
  • Hash Cond: (stock_quant_move_rel_1.move_id = stock_move_1.id)
  • Buckets: 65,536 Batches: 1 Memory Usage: 39,200kB
  • 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: 10,577
  • Buckets: 1,024 Batches: 1 Memory Usage: 5kB
  • Filter: ((usage)::text = ANY ('{internal,transit}'::text[]))
  • Rows Removed by Filter: 29
  • Buckets: 1,024 Batches: 1 Memory Usage: 7kB
  • Buckets: 1,024 Batches: 1 Memory Usage: 72kB
  • Hash Cond: (product_template_1.id = product_product_1.product_tmpl_id)
  • Buckets: 1,024 Batches: 1 Memory Usage: 66kB
  • Buckets: 65,536 Batches: 1 Memory Usage: 30,090kB
  • Hash Cond: (quant_1.lot_id = stock_production_lot_1.id)
  • Filter: (qty > 0::double precision)
  • Rows Removed by Filter: 194
  • Buckets: 1,024 Batches: 1 Memory Usage: 59kB
  • -> 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.189 rows=1,270 loops=1)"Total runtime: 16,018.372 ms
2. 12,392.331 12,392.331 ↑ 1.1 2,849,701 1

Sort (cost=762,673.69..770,571.27 rows=3,159,032 width=72) (actual time=11,543.709..12,392.331 rows=2,849,701 loops=1)

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

Append (cost=83,308.50..421,639.58 rows=3,159,032 width=72) (actual time=501.305..7,272.437 rows=2,849,701 loops=1)

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

Subquery Scan on *SELECT* 1 (cost=83,308.50..206,871.00 rows=1,579,516 width=72) (actual time=501.304..2,525.738 rows=1,426,758 loops=1)

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

Hash Join (cost=83,308.50..191,075.84 rows=1,579,516 width=68) (actual time=501.304..2,371.765 rows=1,426,758 loops=1)

6. 1,093.826 1,093.826 ↑ 1.1 1,426,763 1

Hash Join (cost=57,105.35..127,350.62 rows=1,580,138 width=47) (actual time=255.598..1,093.826 rows=1,426,763 loops=1)

7. 155.547 155.547 ↑ 1.0 2,022,040 1

Seq Scan on stock_quant_move_rel (cost=0.00..29,168.40 rows=2,022,040 width=8) (actual time=0.004..155.547 rows=2,022,040 loops=1)

8. 255.400 255.400 ↑ 7.1 72,692 1

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

9. 239.333 239.333 ↑ 7.1 72,692 1

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

10. 222.103 222.103 ↑ 7.1 72,692 1

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

11. 208.291 208.291 ↑ 7.1 72,692 1

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

12. 121.454 121.454 ↓ 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..121.454 rows=647,142 loops=1)

13. 0.041 0.041 ↑ 1.0 114 1

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

14. 0.027 0.027 ↑ 1.0 114 1

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

15. 0.044 0.044 ↑ 1.0 143 1

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

16. 0.024 0.024 ↑ 1.0 143 1

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

17. 1.217 1.217 ↑ 1.0 1,670 1

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

18. 0.999 0.999 ↑ 1.0 1,670 1

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

19. 0.161 0.161 ↑ 1.0 1,670 1

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

20. 0.360 0.360 ↑ 1.0 1,670 1

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

21. 0.187 0.187 ↑ 1.0 1,670 1

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

22. 245.426 245.426 ↓ 1.0 592,223 1

Hash (cost=18,800.86..18,800.86 rows=592,184 width=29) (actual time=245.426..245.426 rows=592,223 loops=1)

23. 150.601 150.601 ↓ 1.0 592,223 1

Hash Left Join (cost=43.58..18,800.86 rows=592,184 width=29) (actual time=0.491..150.601 rows=592,223 loops=1)

24. 74.326 74.326 ↓ 1.0 592,223 1

Seq Scan on stock_quant quant (cost=0.00..16,520.21 rows=592,184 width=24) (actual time=0.006..74.326 rows=592,223 loops=1)

25. 0.475 0.475 ↑ 1.0 1,270 1

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

26. 0.216 0.216 ↑ 1.0 1,270 1

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

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

Subquery Scan on *SELECT* 2 (cost=83,308.50..214,768.58 rows=1,579,516 width=72) (actual time=799.794..4,533.548 rows=1,422,943 loops=1)

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

Hash Join (cost=83,308.50..198,973.42 rows=1,579,516 width=68) (actual time=799.793..4,363.998 rows=1,422,943 loops=1)

29. 2,622.394 2,622.394 ↑ 1.1 1,423,137 1

Hash Join (cost=57,105.35..127,350.62 rows=1,580,138 width=47) (actual time=590.492..2,622.394 rows=1,423,137 loops=1)

30. 179.310 179.310 ↑ 1.0 2,022,040 1

Seq Scan on stock_quant_move_rel stock_quant_move_rel_1 (cost=0.00..29,168.40 rows=2,022,040 width=8) (actual time=0.004..179.310 rows=2,022,040 loops=1)

31. 590.459 590.459 ↓ 1.2 623,495 1

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

32. 491.349 491.349 ↓ 1.2 623,495 1

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

33. 372.060 372.060 ↓ 1.2 623,495 1

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

34. 267.375 267.375 ↓ 1.2 623,495 1

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

35. 125.637 125.637 ↓ 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.005..125.637 rows=647,142 loops=1)

36. 0.037 0.037 ↑ 1.0 114 1

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

37. 0.026 0.026 ↑ 1.0 114 1

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

38. 0.039 0.039 ↑ 1.0 143 1

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

39. 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.002..0.024 rows=143 loops=1)

40. 1.079 1.079 ↑ 1.0 1,670 1

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

41. 0.908 0.908 ↑ 1.0 1,670 1

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

42. 0.149 0.149 ↑ 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.001..0.149 rows=1,670 loops=1)

43. 0.305 0.305 ↑ 1.0 1,670 1

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

44. 0.155 0.155 ↑ 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.002..0.155 rows=1,670 loops=1)

45. 209.262 209.262 ↓ 1.0 592,223 1

Hash (cost=18,800.86..18,800.86 rows=592,184 width=29) (actual time=209.262..209.262 rows=592,223 loops=1)

46. 132.050 132.050 ↓ 1.0 592,223 1

Hash Left Join (cost=43.58..18,800.86 rows=592,184 width=29) (actual time=0.380..132.050 rows=592,223 loops=1)

47. 64.950 64.950 ↓ 1.0 592,223 1

Seq Scan on stock_quant quant_1 (cost=0.00..16,520.21 rows=592,184 width=24) (actual time=0.005..64.950 rows=592,223 loops=1)

48. 0.370 0.370 ↑ 1.0 1,270 1

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