explain.depesz.com

PostgreSQL's explain analyze made readable

Result: lbv5

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 0.000 ↓ 0.0

Sort (cost=445.09..445.11 rows=8 width=240) (actual rows= loops=)

  • Sort Key: t.date
2. 0.000 0.000 ↓ 0.0

Subquery Scan on t (cost=0.00..444.97 rows=8 width=240) (actual rows= loops=)

3. 0.000 0.000 ↓ 0.0

Append (cost=0.00..444.87 rows=8 width=201) (actual rows= loops=)

4. 0.000 0.000 ↓ 0.0

Result (cost=0.00..111.89 rows=7 width=201) (actual rows= loops=)

5. 0.000 0.000 ↓ 0.0

Append (cost=0.00..111.89 rows=7 width=201) (actual rows= loops=)

6. 0.000 0.000 ↓ 0.0

Result (cost=0.00..38.26 rows=3 width=158) (actual rows= loops=)

7. 0.000 0.000 ↓ 0.0

Append (cost=0.00..38.26 rows=3 width=158) (actual rows= loops=)

8. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.00..12.54 rows=1 width=158) (actual rows= loops=)

  • Join Filter: (purchase_details.purchaseid = purchase.indexvalue)
9. 0.000 0.000 ↓ 0.0

Seq Scan on purchase_details (cost=0.00..11.50 rows=1 width=118) (actual rows= loops=)

  • Filter: (itemid = 'IT7'::text)
10. 0.000 0.000 ↓ 0.0

Seq Scan on purchase (cost=0.00..1.02 rows=1 width=72) (actual rows= loops=)

  • Filter: ((vouchertype = 'Purchase'::text) AND ((invoicedate)::date >= '2019-04-01'::date) AND ((invoicedate)::date <= '2020-03-31'::date))
11. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.00..12.84 rows=1 width=158) (actual rows= loops=)

  • Join Filter: (purchase_details_1.purchaseid = purchase_1.indexvalue)
12. 0.000 0.000 ↓ 0.0

Seq Scan on purchase_details purchase_details_1 (cost=0.00..11.80 rows=1 width=118) (actual rows= loops=)

  • Filter: ((itemid = 'IT7'::text) AND (vouchertype = 'Manufacture'::text))
13. 0.000 0.000 ↓ 0.0

Seq Scan on purchase purchase_1 (cost=0.00..1.02 rows=1 width=72) (actual rows= loops=)

  • Filter: ((vouchertype = 'Manufacture'::text) AND ((invoicedate)::date >= '2019-04-01'::date) AND ((invoicedate)::date <= '2020-03-31'::date))
14. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.00..12.84 rows=1 width=158) (actual rows= loops=)

  • Join Filter: (purchase_details_2.purchaseid = purchase_2.indexvalue)
15. 0.000 0.000 ↓ 0.0

Seq Scan on purchase_details purchase_details_2 (cost=0.00..11.80 rows=1 width=118) (actual rows= loops=)

  • Filter: ((itemid = 'IT7'::text) AND (vouchertype = 'By Product'::text))
16. 0.000 0.000 ↓ 0.0

Seq Scan on purchase purchase_2 (cost=0.00..1.02 rows=1 width=72) (actual rows= loops=)

  • Filter: ((vouchertype = 'Manufacture'::text) AND ((invoicedate)::date >= '2019-04-01'::date) AND ((invoicedate)::date <= '2020-03-31'::date))
17. 0.000 0.000 ↓ 0.0

Subquery Scan on *SELECT* 4 (cost=0.14..22.10 rows=1 width=216) (actual rows= loops=)

18. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.14..22.09 rows=1 width=216) (actual rows= loops=)

19. 0.000 0.000 ↓ 0.0

Seq Scan on purchasereturn_details (cost=0.00..11.38 rows=1 width=176) (actual rows= loops=)

  • Filter: (itemid = 'IT7'::text)
20. 0.000 0.000 ↓ 0.0

Index Scan using purchasereturn_pkey on purchasereturn (cost=0.14..8.17 rows=1 width=72) (actual rows= loops=)

  • Index Cond: (indexvalue = purchasereturn_details.purchasereturnid)
  • Filter: (((purchasereturndate)::date >= '2019-04-01'::date) AND ((purchasereturndate)::date <= '2020-03-31'::date))
21.          

SubPlan (forNested Loop)

22. 0.000 0.000 ↓ 0.0

Aggregate (cost=1.25..1.26 rows=1 width=8) (actual rows= loops=)

23. 0.000 0.000 ↓ 0.0

Function Scan on unnest s_12 (cost=0.00..1.00 rows=100 width=8) (actual rows= loops=)

24. 0.000 0.000 ↓ 0.0

Aggregate (cost=1.25..1.26 rows=1 width=8) (actual rows= loops=)

25. 0.000 0.000 ↓ 0.0

Function Scan on unnest s_13 (cost=0.00..1.00 rows=100 width=8) (actual rows= loops=)

26. 0.000 0.000 ↓ 0.0

Subquery Scan on *SELECT* 5 (cost=14.74..14.77 rows=1 width=264) (actual rows= loops=)

27. 0.000 0.000 ↓ 0.0

HashAggregate (cost=14.74..14.76 rows=1 width=264) (actual rows= loops=)

  • Group Key: sales_details.saleid, sales.saledate, sales_details.uomqty, sales_details.uomname, sales_details.baseqty, sales.indexvalue, (sales_details.purchaseindex)::text, sales_details.priceunitbeforetax
28. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.00..12.19 rows=1 width=264) (actual rows= loops=)

  • Join Filter: (sales_details.saleid = sales.indexvalue)
29. 0.000 0.000 ↓ 0.0

Seq Scan on sales_details (cost=0.00..11.13 rows=1 width=192) (actual rows= loops=)

  • Filter: (itemid = 'IT7'::text)
30. 0.000 0.000 ↓ 0.0

Seq Scan on sales (cost=0.00..1.04 rows=1 width=72) (actual rows= loops=)

  • Filter: ((NOT estimationsale) AND (vouchertype = 'Sales'::text) AND ((saledate)::date >= '2019-04-01'::date) AND ((saledate)::date <= '2020-03-31'::date))
31.          

SubPlan (forHashAggregate)

32. 0.000 0.000 ↓ 0.0

Aggregate (cost=1.25..1.26 rows=1 width=8) (actual rows= loops=)

33. 0.000 0.000 ↓ 0.0

Function Scan on unnest s_10 (cost=0.00..1.00 rows=100 width=8) (actual rows= loops=)

34. 0.000 0.000 ↓ 0.0

Aggregate (cost=1.25..1.26 rows=1 width=8) (actual rows= loops=)

35. 0.000 0.000 ↓ 0.0

Function Scan on unnest s_11 (cost=0.00..1.00 rows=100 width=8) (actual rows= loops=)

36. 0.000 0.000 ↓ 0.0

Result (cost=0.00..0.01 rows=1 width=0) (actual rows= loops=)

37. 0.000 0.000 ↓ 0.0

Subquery Scan on *SELECT* 6 (cost=14.74..14.77 rows=1 width=264) (actual rows= loops=)

38. 0.000 0.000 ↓ 0.0

HashAggregate (cost=14.74..14.76 rows=1 width=264) (actual rows= loops=)

  • Group Key: sales_details_1.saleid, sales_1.saledate, sales_details_1.uomqty, sales_details_1.uomname, sales_details_1.baseqty, sales_1.indexvalue, (sales_details_1.purchaseindex)::text, sales_details_1.priceunitbeforet (...)
39. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.00..12.19 rows=1 width=264) (actual rows= loops=)

  • Join Filter: (sales_details_1.saleid = sales_1.indexvalue)
40. 0.000 0.000 ↓ 0.0

Seq Scan on sales_details sales_details_1 (cost=0.00..11.13 rows=1 width=192) (actual rows= loops=)

  • Filter: (itemid = 'IT7'::text)
41. 0.000 0.000 ↓ 0.0

Seq Scan on sales sales_1 (cost=0.00..1.04 rows=1 width=72) (actual rows= loops=)

  • Filter: ((NOT estimationsale) AND (vouchertype = 'Manufacture'::text) AND ((saledate)::date >= '2019-04-01'::date) AND ((saledate)::date <= '2020-03-31'::date))
42.          

SubPlan (forHashAggregate)

43. 0.000 0.000 ↓ 0.0

Aggregate (cost=1.25..1.26 rows=1 width=8) (actual rows= loops=)

44. 0.000 0.000 ↓ 0.0

Function Scan on unnest s_8 (cost=0.00..1.00 rows=100 width=8) (actual rows= loops=)

45. 0.000 0.000 ↓ 0.0

Aggregate (cost=1.25..1.26 rows=1 width=8) (actual rows= loops=)

46. 0.000 0.000 ↓ 0.0

Function Scan on unnest s_9 (cost=0.00..1.00 rows=100 width=8) (actual rows= loops=)

47. 0.000 0.000 ↓ 0.0

Result (cost=0.00..0.01 rows=1 width=0) (actual rows= loops=)

48. 0.000 0.000 ↓ 0.0

Subquery Scan on *SELECT* 7 (cost=0.14..21.98 rows=1 width=188) (actual rows= loops=)

49. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.14..21.97 rows=1 width=188) (actual rows= loops=)

50. 0.000 0.000 ↓ 0.0

Seq Scan on salesreturn_details (cost=0.00..11.25 rows=1 width=176) (actual rows= loops=)

  • Filter: (itemid = 'IT7'::text)
51. 0.000 0.000 ↓ 0.0

Index Scan using salesreturn_pkey on salesreturn (cost=0.14..8.17 rows=1 width=44) (actual rows= loops=)

  • Index Cond: (indexvalue = salesreturn_details.salereturnid)
  • Filter: (((salereturndate)::date >= '2019-04-01'::date) AND ((salereturndate)::date <= '2020-03-31'::date))
52.          

SubPlan (forNested Loop)

53. 0.000 0.000 ↓ 0.0

Aggregate (cost=1.25..1.26 rows=1 width=8) (actual rows= loops=)

54. 0.000 0.000 ↓ 0.0

Function Scan on unnest s_6 (cost=0.00..1.00 rows=100 width=8) (actual rows= loops=)

55. 0.000 0.000 ↓ 0.0

Aggregate (cost=1.25..1.26 rows=1 width=8) (actual rows= loops=)

56. 0.000 0.000 ↓ 0.0

Function Scan on unnest s_7 (cost=0.00..1.00 rows=100 width=8) (actual rows= loops=)

57. 0.000 0.000 ↓ 0.0

Nested Loop (cost=106.32..332.97 rows=1 width=204) (actual rows= loops=)

58.          

Initplan (forNested Loop)

59. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=1.48..106.17 rows=1 width=80) (actual rows= loops=)

  • Join Filter: (item.itemid = stockadjustment_details_1.itemid)
60. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=1.33..84.68 rows=1 width=72) (actual rows= loops=)

  • Join Filter: (item.itemid = salesreturn_details_1.itemid)
61. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=1.19..62.68 rows=1 width=64) (actual rows= loops=)

  • Join Filter: (item.itemid = sales_details_2.itemid)
62. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=1.19..47.95 rows=1 width=56) (actual rows= loops=)

  • Join Filter: (item.itemid = purchasereturn_details_1.itemid)
63. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=1.05..25.83 rows=1 width=48) (actual rows= loops=)

  • Join Filter: (item.itemid = purchase_details_3.itemid)
64. 0.000 0.000 ↓ 0.0

Hash Join (cost=1.05..13.26 rows=1 width=40) (actual rows= loops=)

  • Hash Cond: (itemgroup.id = item.itemgroupid)
65. 0.000 0.000 ↓ 0.0

Seq Scan on itemgroup (cost=0.00..11.60 rows=160 width=2) (actual rows= loops=)

66. 0.000 0.000 ↓ 0.0

Hash (cost=1.03..1.03 rows=1 width=42) (actual rows= loops=)

67. 0.000 0.000 ↓ 0.0

Seq Scan on item (cost=0.00..1.03 rows=1 width=42) (actual rows= loops=)

  • Filter: ((itemid = 'IT7'::text) AND ((opstockdate)::date < '2019-04-01'::date))
68. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=0.00..12.55 rows=1 width=48) (actual rows= loops=)

  • Group Key: purchase_details_3.itemid
69. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.00..12.53 rows=1 width=48) (actual rows= loops=)

  • Join Filter: (purchase_details_3.purchaseid = purchase_3.indexvalue)
70. 0.000 0.000 ↓ 0.0

Seq Scan on purchase_details purchase_details_3 (cost=0.00..11.50 rows=1 width=80) (actual rows= loops=)

  • Filter: (itemid = 'IT7'::text)
71. 0.000 0.000 ↓ 0.0

Seq Scan on purchase purchase_3 (cost=0.00..1.01 rows=1 width=32) (actual rows= loops=)

  • Filter: ((purchasedate)::date < '2019-04-01'::date)
72. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=0.14..22.10 rows=1 width=96) (actual rows= loops=)

  • Group Key: purchasereturn_details_1.itemid
73. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.14..19.55 rows=1 width=96) (actual rows= loops=)

74. 0.000 0.000 ↓ 0.0

Seq Scan on purchasereturn_details purchasereturn_details_1 (cost=0.00..11.38 rows=1 width=128) (actual rows= loops=)

  • Filter: (itemid = 'IT7'::text)
75. 0.000 0.000 ↓ 0.0

Index Scan using purchasereturn_pkey on purchasereturn purchasereturn_1 (cost=0.14..8.17 rows=1 width=32) (actual rows= loops=)

  • Index Cond: (indexvalue = purchasereturn_details_1.purchasereturnid)
  • Filter: ((purchasereturndate)::date < '2019-04-01'::date)
76.          

SubPlan (forGroupAggregate)

77. 0.000 0.000 ↓ 0.0

Aggregate (cost=1.25..1.26 rows=1 width=8) (actual rows= loops=)

78. 0.000 0.000 ↓ 0.0

Function Scan on unnest s (cost=0.00..1.00 rows=100 width=8) (actual rows= loops=)

79. 0.000 0.000 ↓ 0.0

Aggregate (cost=1.25..1.26 rows=1 width=8) (actual rows= loops=)

80. 0.000 0.000 ↓ 0.0

Function Scan on unnest s_1 (cost=0.00..1.00 rows=100 width=8) (actual rows= loops=)

81. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=0.00..14.71 rows=1 width=96) (actual rows= loops=)

  • Group Key: sales_details_2.itemid
82. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.00..12.17 rows=1 width=96) (actual rows= loops=)

  • Join Filter: (sales_details_2.saleid = sales_2.indexvalue)
83. 0.000 0.000 ↓ 0.0

Seq Scan on sales_details sales_details_2 (cost=0.00..11.13 rows=1 width=128) (actual rows= loops=)

  • Filter: (itemid = 'IT7'::text)
84. 0.000 0.000 ↓ 0.0

Seq Scan on sales sales_2 (cost=0.00..1.03 rows=1 width=32) (actual rows= loops=)

  • Filter: ((NOT estimationsale) AND ((saledate)::date < '2019-04-01'::date))
85.          

SubPlan (forGroupAggregate)

86. 0.000 0.000 ↓ 0.0

Aggregate (cost=1.25..1.26 rows=1 width=8) (actual rows= loops=)

87. 0.000 0.000 ↓ 0.0

Function Scan on unnest s_2 (cost=0.00..1.00 rows=100 width=8) (actual rows= loops=)

88. 0.000 0.000 ↓ 0.0

Aggregate (cost=1.25..1.26 rows=1 width=8) (actual rows= loops=)

89. 0.000 0.000 ↓ 0.0

Function Scan on unnest s_3 (cost=0.00..1.00 rows=100 width=8) (actual rows= loops=)

90. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=0.14..21.97 rows=1 width=96) (actual rows= loops=)

  • Group Key: salesreturn_details_1.itemid
91. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.14..19.43 rows=1 width=96) (actual rows= loops=)

92. 0.000 0.000 ↓ 0.0

Seq Scan on salesreturn_details salesreturn_details_1 (cost=0.00..11.25 rows=1 width=128) (actual rows= loops=)

  • Filter: (itemid = 'IT7'::text)
93. 0.000 0.000 ↓ 0.0

Index Scan using salesreturn_pkey on salesreturn salesreturn_1 (cost=0.14..8.17 rows=1 width=32) (actual rows= loops=)

  • Index Cond: (indexvalue = salesreturn_details_1.salereturnid)
  • Filter: ((salereturndate)::date < '2019-04-01'::date)
94.          

SubPlan (forGroupAggregate)

95. 0.000 0.000 ↓ 0.0

Aggregate (cost=1.25..1.26 rows=1 width=8) (actual rows= loops=)

96. 0.000 0.000 ↓ 0.0

Function Scan on unnest s_4 (cost=0.00..1.00 rows=100 width=8) (actual rows= loops=)

97. 0.000 0.000 ↓ 0.0

Aggregate (cost=1.25..1.26 rows=1 width=8) (actual rows= loops=)

98. 0.000 0.000 ↓ 0.0

Function Scan on unnest s_5 (cost=0.00..1.00 rows=100 width=8) (actual rows= loops=)

99. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=0.15..21.46 rows=1 width=64) (actual rows= loops=)

  • Group Key: stockadjustment_details_1.itemid
100. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.15..20.18 rows=1 width=64) (actual rows= loops=)

101. 0.000 0.000 ↓ 0.0

Seq Scan on stockadjustment_details stockadjustment_details_1 (cost=0.00..12.00 rows=1 width=96) (actual rows= loops=)

  • Filter: (itemid = 'IT7'::text)
102. 0.000 0.000 ↓ 0.0

Index Scan using "StockAdjustment_PKey" on stockadjustment stockadjustment_1 (cost=0.15..8.17 rows=1 width=32) (actual rows= loops=)

  • Index Cond: (indexvalue = stockadjustment_details_1.said)
  • Filter: ((date)::date < '2019-04-01'::date)
103.          

SubPlan (forGroupAggregate)

104. 0.000 0.000 ↓ 0.0

Aggregate (cost=1.25..1.26 rows=1 width=8) (actual rows= loops=)

105. 0.000 0.000 ↓ 0.0

Function Scan on unnest q (cost=0.00..1.00 rows=100 width=8) (actual rows= loops=)

106. 0.000 0.000 ↓ 0.0

Seq Scan on stockadjustment_details (cost=0.00..214.80 rows=1 width=164) (actual rows= loops=)

  • Filter: ((itemid = 'IT7'::text) AND (abs((SubPlan 12)) <> 0::double precision))
107.          

SubPlan (forSeq Scan)

108. 0.000 0.000 ↓ 0.0

Aggregate (cost=1.25..1.26 rows=1 width=8) (actual rows= loops=)

109. 0.000 0.000 ↓ 0.0

Function Scan on unnest q_4 (cost=0.00..1.00 rows=100 width=8) (actual rows= loops=)

110. 0.000 0.000 ↓ 0.0

Index Scan using "StockAdjustment_PKey" on stockadjustment (cost=0.15..8.18 rows=1 width=72) (actual rows= loops=)

  • Index Cond: (indexvalue = stockadjustment_details.said)
  • Filter: (((date)::date >= '2019-04-01'::date) AND ((date)::date <= '2020-03-31'::date))
111.          

SubPlan (forNested Loop)

112. 0.000 0.000 ↓ 0.0

Aggregate (cost=1.25..1.26 rows=1 width=8) (actual rows= loops=)

113. 0.000 0.000 ↓ 0.0

Function Scan on unnest q_1 (cost=0.00..1.00 rows=100 width=8) (actual rows= loops=)

114. 0.000 0.000 ↓ 0.0

Aggregate (cost=1.25..1.26 rows=1 width=8) (actual rows= loops=)

115. 0.000 0.000 ↓ 0.0

Function Scan on unnest q_2 (cost=0.00..1.00 rows=100 width=8) (actual rows= loops=)

116. 0.000 0.000 ↓ 0.0

Aggregate (cost=1.25..1.26 rows=1 width=8) (actual rows= loops=)

117. 0.000 0.000 ↓ 0.0

Function Scan on unnest q_3 (cost=0.00..1.00 rows=100 width=8) (actual rows= loops=)