explain.depesz.com

PostgreSQL's explain analyze made readable

Result: O5my

Settings
# exclusive inclusive rows x rows loops node
1. 2.837 39.968 ↓ 23.8 286 1

Sort (cost=20,000,004,882.10..20,000,004,882.13 rows=12 width=710) (actual time=39.951..39.968 rows=286 loops=1)

  • Sort Key: real_inventory."dateInventory", real_inventory."labelStorageType", real_inventory."labelSupplierProduct", real_inventory."labelSupplier", real_inventory."idSupplierProduct", real_inventory."idCodeSupplierProduct", real_inventory."idAnalyticalGroupProduct
  • Sort Method: quicksort Memory: 184kB
2.          

CTE inventory

3. 1.162 1.194 ↑ 1.0 1 1

Update on "Inventory" (cost=0.14..8.16 rows=1 width=38) (actual time=1.192..1.194 rows=1 loops=1)

4. 0.032 0.032 ↑ 1.0 1 1

Index Scan using "Inventory_UK" on "Inventory" (cost=0.14..8.16 rows=1 width=38) (actual time=0.031..0.032 rows=1 loops=1)

  • Index Cond: (("idSiteOwner" = 89) AND ("dateInventory" = '2020-01-31 00:00:00'::timestamp without time zone))
5.          

CTE new_list_products

6. 1.325 1.325 ↓ 2.9 285 1

Function Scan on sub (cost=0.05..1.05 rows=100 width=143) (actual time=0.859..1.325 rows=285 loops=1)

7.          

CTE merged_inventory_product_full

8. 0.502 4.233 ↑ 1.6 285 1

Nested Loop Left Join (cost=10,000,000,004.10..10,000,004,615.48 rows=458 width=113) (actual time=2.074..4.233 rows=285 loops=1)

9. 0.092 2.591 ↑ 1.6 285 1

Nested Loop (cost=10,000,000,003.67..10,000,000,802.63 rows=458 width=102) (actual time=2.058..2.591 rows=285 loops=1)

10. 0.001 0.001 ↑ 1.0 1 1

CTE Scan on inventory (cost=0.00..0.02 rows=1 width=8) (actual time=0.000..0.001 rows=1 loops=1)

11. 0.207 2.498 ↑ 1.6 285 1

Hash Full Join (cost=3.67..798.03 rows=458 width=94) (actual time=2.055..2.498 rows=285 loops=1)

  • Hash Cond: ("Inventory_Product"."idSupplierProduct" = new_row."idSupplierProduct")
12. 0.096 0.260 ↑ 1.6 285 1

Nested Loop (cost=0.42..793.05 rows=458 width=21) (actual time=0.019..0.260 rows=285 loops=1)

13. 0.001 0.001 ↑ 1.0 1 1

CTE Scan on inventory inventory_1 (cost=0.00..0.02 rows=1 width=4) (actual time=0.000..0.001 rows=1 loops=1)

14. 0.163 0.163 ↑ 1.6 285 1

Index Scan using "Inventory_Product_PK" on "Inventory_Product" (cost=0.42..788.45 rows=458 width=25) (actual time=0.016..0.163 rows=285 loops=1)

  • Index Cond: ("idInventory" = inventory_1.id)
15. 0.148 2.031 ↓ 2.9 285 1

Hash (cost=2.00..2.00 rows=100 width=73) (actual time=2.031..2.031 rows=285 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 25kB
16. 1.883 1.883 ↓ 2.9 285 1

CTE Scan on new_list_products new_row (cost=0.00..2.00 rows=100 width=73) (actual time=0.863..1.883 rows=285 loops=1)

17. 1.140 1.140 ↑ 1.0 1 285

Index Scan using "SupplierProduct_PK" on "SupplierProduct" (cost=0.42..8.32 rows=1 width=14) (actual time=0.004..0.004 rows=1 loops=285)

  • Index Cond: (id = new_row."idSupplierProduct")
18.          

CTE deleted_inventory_product

19. 0.000 0.060 ↓ 0.0 0 1

Delete on "Inventory_Product" "Inventory_Product_1" (cost=0.42..27.19 rows=1 width=38) (actual time=0.060..0.060 rows=0 loops=1)

20. 0.001 0.060 ↓ 0.0 0 1

Nested Loop (cost=0.42..27.19 rows=1 width=38) (actual time=0.060..0.060 rows=0 loops=1)

21. 0.059 0.059 ↓ 0.0 0 1

CTE Scan on merged_inventory_product_full (cost=0.00..10.30 rows=2 width=40) (actual time=0.059..0.059 rows=0 loops=1)

  • Filter: ("sqlMethod" = 'D'::text)
  • Rows Removed by Filter: 285
22. 0.000 0.000 ↓ 0.0 0

Index Scan using "Inventory_Product_PK" on "Inventory_Product" "Inventory_Product_1" (cost=0.42..8.44 rows=1 width=14) (never executed)

  • Index Cond: (("idInventory" = merged_inventory_product_full."idInventory") AND ("idSupplierProduct" = merged_inventory_product_full."idSupplierProduct"))
23.          

CTE inserted_inventory_product

24. 0.001 4.587 ↓ 0.0 0 1

Insert on "Inventory_Product" "Inventory_Product_2" (cost=0.45..18.81 rows=1 width=76) (actual time=4.587..4.587 rows=0 loops=1)

25. 0.000 4.586 ↓ 0.0 0 1

Nested Loop Left Join (cost=0.45..18.81 rows=1 width=76) (actual time=4.586..4.586 rows=0 loops=1)

  • Join Filter: ("SupplierProductAllowedFlat"."dateValid" @> (inventory_2."dateInventory")::date)
26. 0.001 4.586 ↓ 0.0 0 1

Hash Join (cost=0.03..10.36 rows=1 width=88) (actual time=4.586..4.586 rows=0 loops=1)

  • Hash Cond: (merged_inventory_product_full_1."idInventory" = inventory_2.id)
27. 4.585 4.585 ↓ 0.0 0 1

CTE Scan on merged_inventory_product_full merged_inventory_product_full_1 (cost=0.00..10.30 rows=2 width=80) (actual time=4.585..4.585 rows=0 loops=1)

  • Filter: ("sqlMethod" = 'I'::text)
  • Rows Removed by Filter: 285
28. 0.000 0.000 ↓ 0.0 0

Hash (cost=0.02..0.02 rows=1 width=12) (never executed)

29. 0.000 0.000 ↓ 0.0 0

CTE Scan on inventory inventory_2 (cost=0.00..0.02 rows=1 width=12) (never executed)

30. 0.000 0.000 ↓ 0.0 0

Index Scan using "SupplierProductAllowedFlat_idSupplierProduct" on "SupplierProductAllowedFlat" (cost=0.42..8.44 rows=1 width=75) (never executed)

  • Index Cond: ("idSupplierProduct" = merged_inventory_product_full_1."idSupplierProduct")
  • Filter: (("allowedSites" @> ARRAY[merged_inventory_product_full_1."idSiteOwner"]) AND ("allowedSuppliers" @> ARRAY[merged_inventory_product_full_1."idSupplier"]))
31.          

CTE updated_inventory_product_isedited

32. 1.053 1.138 ↑ 1.0 1 1

Update on "Inventory_Product" "Inventory_Product_3" (cost=0.42..18.75 rows=1 width=123) (actual time=1.074..1.138 rows=1 loops=1)

33. 0.002 0.085 ↑ 1.0 1 1

Nested Loop (cost=0.42..18.75 rows=1 width=123) (actual time=0.022..0.085 rows=1 loops=1)

34. 0.073 0.073 ↑ 1.0 1 1

CTE Scan on merged_inventory_product_full merged_inventory_product_full_2 (cost=0.00..10.30 rows=1 width=104) (actual time=0.010..0.073 rows=1 loops=1)

  • Filter: ("isEdited" AND ("sqlMethod" = 'U'::text))
  • Rows Removed by Filter: 284
35. 0.010 0.010 ↑ 1.0 1 1

Index Scan using "Inventory_Product_PK" on "Inventory_Product" "Inventory_Product_3" (cost=0.42..8.44 rows=1 width=27) (actual time=0.010..0.010 rows=1 loops=1)

  • Index Cond: (("idInventory" = merged_inventory_product_full_2."idInventory") AND ("idSupplierProduct" = merged_inventory_product_full_2."idSupplierProduct"))
36.          

CTE updated_inventory_product

37. 0.047 2.621 ↓ 142.5 285 1

Append (cost=0.00..18.79 rows=2 width=46) (actual time=1.076..2.621 rows=285 loops=1)

38. 1.140 1.140 ↑ 1.0 1 1

CTE Scan on updated_inventory_product_isedited (cost=0.00..0.02 rows=1 width=72) (actual time=1.076..1.140 rows=1 loops=1)

39. 0.162 1.434 ↓ 284.0 284 1

Nested Loop (cost=0.42..18.75 rows=1 width=21) (actual time=0.012..1.434 rows=284 loops=1)

40. 0.136 0.136 ↓ 284.0 284 1

CTE Scan on merged_inventory_product_full merged_inventory_product_full_3 (cost=0.00..10.30 rows=1 width=8) (actual time=0.002..0.136 rows=284 loops=1)

  • Filter: ((NOT "isEdited") AND ("sqlMethod" = 'U'::text))
  • Rows Removed by Filter: 1
41. 1.136 1.136 ↑ 1.0 1 284

Index Scan using "Inventory_Product_PK" on "Inventory_Product" "Inventory_Product_4" (cost=0.42..8.44 rows=1 width=25) (actual time=0.004..0.004 rows=1 loops=284)

  • Index Cond: (("idInventory" = merged_inventory_product_full_3."idInventory") AND ("idSupplierProduct" = merged_inventory_product_full_3."idSupplierProduct"))
42.          

CTE inventory_products

43. 0.110 7.672 ↓ 57.0 285 1

Nested Loop (cost=10,000,000,000.00..10,000,000,010.48 rows=5 width=78) (actual time=5.668..7.672 rows=285 loops=1)

44. 0.001 0.001 ↑ 1.0 1 1

CTE Scan on inventory inventory_3 (cost=0.00..0.02 rows=1 width=6) (actual time=0.000..0.001 rows=1 loops=1)

45. 0.049 7.561 ↓ 57.0 285 1

Append (cost=0.00..10.41 rows=5 width=72) (actual time=5.665..7.561 rows=285 loops=1)

46. 4.587 4.587 ↓ 0.0 0 1

CTE Scan on inserted_inventory_product (cost=0.00..0.02 rows=1 width=72) (actual time=4.587..4.587 rows=0 loops=1)

47. 2.851 2.851 ↓ 142.5 285 1

CTE Scan on updated_inventory_product (cost=0.00..0.04 rows=2 width=72) (actual time=1.077..2.851 rows=285 loops=1)

48. 0.000 0.074 ↓ 0.0 0 1

Subquery Scan on *SELECT* 3 (cost=0.00..10.32 rows=2 width=72) (actual time=0.074..0.074 rows=0 loops=1)

49. 0.074 0.074 ↓ 0.0 0 1

CTE Scan on merged_inventory_product_full merged_inventory_product_full_4 (cost=0.00..10.30 rows=2 width=72) (actual time=0.074..0.074 rows=0 loops=1)

  • Filter: ("sqlMethod" = ''::text)
  • Rows Removed by Filter: 285
50.          

CTE existing_products_storagetype

51. 0.071 2.158 ↓ 197.0 197 1

Unique (cost=11.18..11.18 rows=1 width=16) (actual time=2.065..2.158 rows=197 loops=1)

52. 0.127 2.087 ↓ 197.0 197 1

Sort (cost=11.18..11.18 rows=1 width=16) (actual time=2.064..2.087 rows=197 loops=1)

  • Sort Key: "SupplierProduct_1"."idProduct
  • Sort Method: quicksort Memory: 34kB
53. 0.171 1.960 ↓ 197.0 197 1

Nested Loop (cost=0.84..11.17 rows=1 width=16) (actual time=0.019..1.960 rows=197 loops=1)

54. 0.074 1.001 ↓ 197.0 197 1

Nested Loop (cost=0.42..10.69 rows=1 width=12) (actual time=0.008..1.001 rows=197 loops=1)

55. 0.139 0.139 ↓ 197.0 197 1

CTE Scan on new_list_products (cost=0.00..2.25 rows=1 width=12) (actual time=0.001..0.139 rows=197 loops=1)

  • Filter: ("idSiteStorageType" = 89)
  • Rows Removed by Filter: 88
56. 0.788 0.788 ↑ 1.0 1 197

Index Scan using "SupplierProduct_PK" on "SupplierProduct" "SupplierProduct_1" (cost=0.42..8.44 rows=1 width=8) (actual time=0.004..0.004 rows=1 loops=197)

  • Index Cond: (id = new_list_products."idSupplierProduct")
57. 0.788 0.788 ↑ 1.0 1 197

Index Only Scan using "Product_StorageType_PK" on "Product_StorageType" (cost=0.42..0.47 rows=1 width=8) (actual time=0.004..0.004 rows=1 loops=197)

  • Index Cond: (("idProduct" = "SupplierProduct_1"."idProduct") AND ("idSite" = 89))
  • Heap Fetches: 196
58.          

CTE update_product_storage_type

59. 0.001 0.989 ↓ 0.0 0 1

Update on "Product_StorageType" "Product_StorageType_1" (cost=0.42..8.47 rows=1 width=62) (actual time=0.989..0.989 rows=0 loops=1)

60. 0.054 0.988 ↓ 0.0 0 1

Nested Loop (cost=0.42..8.47 rows=1 width=62) (actual time=0.988..0.988 rows=0 loops=1)

61. 0.146 0.146 ↓ 197.0 197 1

CTE Scan on existing_products_storagetype (cost=0.00..0.02 rows=1 width=48) (actual time=0.006..0.146 rows=197 loops=1)

62. 0.788 0.788 ↓ 0.0 0 197

Index Scan using "Product_StorageType_PK" on "Product_StorageType" "Product_StorageType_1" (cost=0.42..8.44 rows=1 width=26) (actual time=0.004..0.004 rows=0 loops=197)

  • Index Cond: (("idProduct" = existing_products_storagetype."idProduct") AND ("idSite" = existing_products_storagetype."idSite"))
  • Filter: ("idStorageType" <> existing_products_storagetype."idStorageType")
  • Rows Removed by Filter: 1
63.          

CTE insert_product_storage_type

64. 0.002 3.382 ↓ 0.0 0 1

Insert on "Product_StorageType" "Product_StorageType_2" (cost=10.75..10.78 rows=1 width=20) (actual time=3.382..3.382 rows=0 loops=1)

65. 0.000 3.380 ↓ 0.0 0 1

Subquery Scan on *SELECT* (cost=10.75..10.78 rows=1 width=20) (actual time=3.380..3.380 rows=0 loops=1)

66. 0.001 3.380 ↓ 0.0 0 1

Unique (cost=10.75..10.76 rows=1 width=12) (actual time=3.380..3.380 rows=0 loops=1)

67. 0.002 3.379 ↓ 0.0 0 1

Sort (cost=10.75..10.76 rows=1 width=12) (actual time=3.379..3.379 rows=0 loops=1)

  • Sort Key: "SupplierProduct_2"."idProduct
  • Sort Method: quicksort Memory: 25kB
68. 0.084 3.377 ↓ 0.0 0 1

Hash Anti Join (cost=0.46..10.74 rows=1 width=12) (actual time=3.376..3.377 rows=0 loops=1)

  • Hash Cond: ((new_list_products_1."idSiteStorageType" = existing_products_storagetype_1."idSite") AND ("SupplierProduct_2"."idProduct" = existing_products_storagetype_1."idProduct"))
69. 0.041 0.960 ↓ 197.0 197 1

Nested Loop (cost=0.42..10.69 rows=1 width=12) (actual time=0.009..0.960 rows=197 loops=1)

70. 0.131 0.131 ↓ 197.0 197 1

CTE Scan on new_list_products new_list_products_1 (cost=0.00..2.25 rows=1 width=12) (actual time=0.002..0.131 rows=197 loops=1)

  • Filter: ("idSiteStorageType" = 89)
  • Rows Removed by Filter: 88
71. 0.788 0.788 ↑ 1.0 1 197

Index Scan using "SupplierProduct_PK" on "SupplierProduct" "SupplierProduct_2" (cost=0.42..8.44 rows=1 width=8) (actual time=0.004..0.004 rows=1 loops=197)

  • Index Cond: (id = new_list_products_1."idSupplierProduct")
72. 0.077 2.333 ↓ 197.0 197 1

Hash (cost=0.02..0.02 rows=1 width=8) (actual time=2.333..2.333 rows=197 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 16kB
73. 2.256 2.256 ↓ 197.0 197 1

CTE Scan on existing_products_storagetype existing_products_storagetype_1 (cost=0.00..0.02 rows=1 width=8) (actual time=2.068..2.256 rows=197 loops=1)

  • Filter: ("idSite" = 89)
74.          

CTE product_storage_type

75. 0.002 4.373 ↓ 0.0 0 1

Append (cost=0.00..0.05 rows=2 width=20) (actual time=4.373..4.373 rows=0 loops=1)

76. 3.382 3.382 ↓ 0.0 0 1

CTE Scan on insert_product_storage_type (cost=0.00..0.02 rows=1 width=20) (actual time=3.382..3.382 rows=0 loops=1)

77. 0.989 0.989 ↓ 0.0 0 1

CTE Scan on update_product_storage_type (cost=0.00..0.02 rows=1 width=20) (actual time=0.989..0.989 rows=0 loops=1)

78.          

CTE theoretical_inventory_products

79. 0.184 0.184 ↓ 2.9 285 1

CTE Scan on new_list_products new_list_products_2 (cost=0.00..2.00 rows=100 width=40) (actual time=0.001..0.184 rows=285 loops=1)

80.          

CTE real_inventory_products

81. 0.206 9.269 ↓ 57.0 285 1

Nested Loop Left Join (cost=0.33..23.84 rows=5 width=112) (actual time=8.147..9.269 rows=285 loops=1)

82. 0.275 8.778 ↓ 57.0 285 1

Hash Right Join (cost=0.17..2.93 rows=5 width=108) (actual time=8.141..8.778 rows=285 loops=1)

  • Hash Cond: ((theoretical_inventory_products."idSiteOwner" = inventory_products."idSiteOwner") AND (theoretical_inventory_products."idSupplierProduct" = inventory_products."idSupplierProduct"))
83. 0.371 0.371 ↓ 2.9 285 1

CTE Scan on theoretical_inventory_products (cost=0.00..2.00 rows=100 width=40) (actual time=0.002..0.371 rows=285 loops=1)

84. 0.153 8.132 ↓ 57.0 285 1

Hash (cost=0.10..0.10 rows=5 width=76) (actual time=8.132..8.132 rows=285 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 25kB
85. 7.979 7.979 ↓ 57.0 285 1

CTE Scan on inventory_products (cost=0.00..0.10 rows=5 width=76) (actual time=5.670..7.979 rows=285 loops=1)

86. 0.285 0.285 ↓ 0.0 0 285

Index Scan using "SupplierProduct_Recipe_UK" on "SupplierProduct_Recipe" (cost=0.15..4.17 rows=1 width=8) (actual time=0.001..0.001 rows=0 loops=285)

  • Index Cond: ("idSupplierProduct" = inventory_products."idSupplierProduct")
87.          

CTE real_inventory

88. 0.039 34.877 ↓ 23.8 286 1

Append (cost=0.03..106.05 rows=12 width=696) (actual time=1.264..34.877 rows=286 loops=1)

89. 0.046 1.301 ↑ 1.0 1 1

Hash Join (cost=0.03..6.83 rows=1 width=558) (actual time=1.263..1.301 rows=1 loops=1)

  • Hash Cond: ("Site".id = inventory_4."idSiteOwner")
90. 0.055 0.055 ↑ 1.0 129 1

Seq Scan on "Site" (cost=0.00..6.29 rows=129 width=34) (actual time=0.018..0.055 rows=129 loops=1)

91. 0.002 1.200 ↑ 1.0 1 1

Hash (cost=0.02..0.02 rows=1 width=27) (actual time=1.200..1.200 rows=1 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
92. 1.198 1.198 ↑ 1.0 1 1

CTE Scan on inventory inventory_4 (cost=0.00..0.02 rows=1 width=27) (actual time=1.196..1.198 rows=1 loops=1)

93. 1.923 33.537 ↓ 25.9 285 1

Hash Right Join (cost=57.47..99.04 rows=11 width=795) (actual time=31.643..33.537 rows=285 loops=1)

  • Hash Cond: ("AnalyticalGroup_ProdFamily"."idProdFamily" = COALESCE("ProdFamily"."idProdFamilyParent", "Product"."idProdFamily"))
94. 0.009 0.009 ↑ 282.5 8 1

Seq Scan on "AnalyticalGroup_ProdFamily" (cost=0.00..32.60 rows=2,260 width=8) (actual time=0.007..0.009 rows=8 loops=1)

95. 0.553 31.605 ↓ 285.0 285 1

Hash (cost=57.46..57.46 rows=1 width=643) (actual time=31.605..31.605 rows=285 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 75kB
96. 0.273 31.052 ↓ 285.0 285 1

Nested Loop Left Join (cost=24.22..57.46 rows=1 width=643) (actual time=22.204..31.052 rows=285 loops=1)

  • Join Filter: "SiteProductionParam"."isUsingVAT
97. 0.542 30.209 ↓ 285.0 285 1

Nested Loop Left Join (cost=24.07..57.28 rows=1 width=615) (actual time=22.195..30.209 rows=285 loops=1)

98. 0.257 25.677 ↓ 285.0 285 1

Nested Loop Left Join (cost=23.93..49.11 rows=1 width=614) (actual time=22.164..25.677 rows=285 loops=1)

99. 0.205 24.850 ↓ 285.0 285 1

Hash Left Join (cost=23.65..40.80 rows=1 width=604) (actual time=22.159..24.850 rows=285 loops=1)

  • Hash Cond: ((real_inventory_products."idSiteOwner" = product_storage_type."idSite") AND ("Product"."idElement" = product_storage_type."idProduct"))
100. 0.213 20.271 ↓ 285.0 285 1

Nested Loop Left Join (cost=23.58..40.71 rows=1 width=600) (actual time=17.776..20.271 rows=285 loops=1)

  • Join Filter: ("Product_StorageType_3"."idSite" = real_inventory_products."idSiteOwner")
101. 0.329 18.918 ↓ 285.0 285 1

Nested Loop Left Join (cost=23.16..40.20 rows=1 width=592) (actual time=17.765..18.918 rows=285 loops=1)

102. 0.273 18.019 ↓ 285.0 285 1

Hash Right Join (cost=23.01..40.04 rows=1 width=590) (actual time=17.754..18.019 rows=285 loops=1)

  • Hash Cond: ("Product_Packaging"."idProduct" = "SupplierProduct_3"."idProduct")
103. 0.005 0.005 ↓ 0.0 0 1

Seq Scan on "Product_Packaging" (cost=0.00..15.10 rows=510 width=126) (actual time=0.005..0.005 rows=0 loops=1)

104. 0.517 17.741 ↓ 285.0 285 1

Hash (cost=23.00..23.00 rows=1 width=472) (actual time=17.741..17.741 rows=285 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 72kB
105. 0.510 17.224 ↓ 285.0 285 1

Nested Loop (cost=1.86..23.00 rows=1 width=472) (actual time=8.220..17.224 rows=285 loops=1)

106. 0.314 16.144 ↓ 285.0 285 1

Nested Loop (cost=1.58..22.71 rows=1 width=458) (actual time=8.211..16.144 rows=285 loops=1)

107. 0.417 14.975 ↓ 285.0 285 1

Nested Loop (cost=1.30..22.41 rows=1 width=444) (actual time=8.202..14.975 rows=285 loops=1)

108. 0.275 13.418 ↓ 285.0 285 1

Nested Loop (cost=0.88..21.88 rows=1 width=429) (actual time=8.192..13.418 rows=285 loops=1)

109. 0.393 12.288 ↓ 285.0 285 1

Nested Loop (cost=0.60..13.58 rows=1 width=211) (actual time=8.183..12.288 rows=285 loops=1)

110. 0.343 10.755 ↓ 285.0 285 1

Nested Loop (cost=0.18..5.14 rows=1 width=169) (actual time=8.173..10.755 rows=285 loops=1)

  • Join Filter: (inventory_5."idSiteOwner" = "Site_1".id)
111. 0.275 9.842 ↓ 285.0 285 1

Hash Join (cost=0.03..0.16 rows=1 width=139) (actual time=8.165..9.842 rows=285 loops=1)

  • Hash Cond: (real_inventory_products."idSiteOwner" = inventory_5."idSiteOwner")
112. 9.558 9.558 ↓ 57.0 285 1

CTE Scan on real_inventory_products (cost=0.00..0.10 rows=5 width=112) (actual time=8.150..9.558 rows=285 loops=1)

113. 0.007 0.009 ↑ 1.0 1 1

Hash (cost=0.02..0.02 rows=1 width=27) (actual time=0.009..0.009 rows=1 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
114. 0.002 0.002 ↑ 1.0 1 1

CTE Scan on inventory inventory_5 (cost=0.00..0.02 rows=1 width=27) (actual time=0.001..0.002 rows=1 loops=1)

115. 0.570 0.570 ↑ 1.0 1 285

Index Scan using "Site_PK" on "Site" "Site_1" (cost=0.14..4.96 rows=1 width=34) (actual time=0.002..0.002 rows=1 loops=285)

  • Index Cond: (id = real_inventory_products."idSiteOwner")
116. 1.140 1.140 ↑ 1.0 1 285

Index Scan using "SupplierProduct_PK" on "SupplierProduct" "SupplierProduct_3" (cost=0.42..8.44 rows=1 width=46) (actual time=0.004..0.004 rows=1 loops=285)

  • Index Cond: (id = real_inventory_products."idSupplierProduct")
117. 0.855 0.855 ↑ 1.0 1 285

Index Scan using "Supplier_PK" on "Supplier" (cost=0.28..8.30 rows=1 width=222) (actual time=0.003..0.003 rows=1 loops=285)

  • Index Cond: (id = real_inventory_products."idSupplier")
118. 1.140 1.140 ↑ 1.0 1 285

Index Scan using "Product_PK" on "Product" (cost=0.42..0.53 rows=1 width=15) (actual time=0.004..0.004 rows=1 loops=285)

  • Index Cond: ("idElement" = "SupplierProduct_3"."idProduct")
119. 0.855 0.855 ↑ 1.0 1 285

Index Scan using "Unit_PK" on "Unit" (cost=0.28..0.30 rows=1 width=18) (actual time=0.003..0.003 rows=1 loops=285)

  • Index Cond: (id = "SupplierProduct_3"."idStorageUnit")
120. 0.570 0.570 ↑ 1.0 1 285

Index Scan using "StorageType_PK" on "StorageType" stpi (cost=0.28..0.30 rows=1 width=18) (actual time=0.002..0.002 rows=1 loops=285)

  • Index Cond: (id = "Product"."idStorageType")
121. 0.570 0.570 ↓ 0.0 0 285

Index Scan using "ProdFamily_PK" on "ProdFamily" (cost=0.15..0.17 rows=1 width=4) (actual time=0.002..0.002 rows=0 loops=285)

  • Index Cond: (id = "Product"."idProdFamily")
  • Filter: ("idProdFamilyParent" <> 1)
  • Rows Removed by Filter: 1
122. 1.140 1.140 ↑ 1.0 1 285

Index Scan using "Product_StorageType_PK" on "Product_StorageType" "Product_StorageType_3" (cost=0.42..0.49 rows=1 width=12) (actual time=0.003..0.004 rows=1 loops=285)

  • Index Cond: ("idProduct" = "Product"."idElement")
123. 0.000 4.374 ↓ 0.0 0 1

Hash (cost=0.04..0.04 rows=2 width=12) (actual time=4.374..4.374 rows=0 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
124. 4.374 4.374 ↓ 0.0 0 1

CTE Scan on product_storage_type (cost=0.00..0.04 rows=2 width=12) (actual time=4.374..4.374 rows=0 loops=1)

125. 0.570 0.570 ↑ 1.0 1 285

Index Scan using "StorageType_PK" on "StorageType" st (cost=0.28..8.29 rows=1 width=18) (actual time=0.002..0.002 rows=1 loops=285)

  • Index Cond: (id = COALESCE(product_storage_type."idStorageType", "Product_StorageType_3"."idStorageType"))
126. 3.990 3.990 ↑ 1.0 1 285

Index Scan using "SiteProductionParam_Unique_Constraint" on "SiteProductionParam" (cost=0.14..8.17 rows=1 width=18) (actual time=0.014..0.014 rows=1 loops=285)

  • Index Cond: (("idSiteOwner" = inventory_5."idSiteOwner") AND ("dateValid" @> (inventory_5."dateInventory")::date))
127. 0.570 0.570 ↑ 1.0 1 285

Index Scan using "Tax_PK" on "Tax" (cost=0.15..0.17 rows=1 width=36) (actual time=0.002..0.002 rows=1 loops=285)

  • Index Cond: (id = "Product"."idTax")
128. 0.634 37.131 ↓ 23.8 286 1

WindowAgg (cost=0.46..0.82 rows=12 width=710) (actual time=36.942..37.131 rows=286 loops=1)

129. 0.421 36.497 ↓ 23.8 286 1

WindowAgg (cost=0.46..0.67 rows=12 width=678) (actual time=36.140..36.497 rows=286 loops=1)

130. 0.432 36.076 ↓ 23.8 286 1

Sort (cost=0.46..0.49 rows=12 width=646) (actual time=36.055..36.076 rows=286 loops=1)

  • Sort Key: real_inventory."idStorageType
  • Sort Method: quicksort Memory: 104kB
131. 35.644 35.644 ↓ 23.8 286 1

CTE Scan on real_inventory (cost=0.00..0.24 rows=12 width=646) (actual time=1.269..35.644 rows=286 loops=1)

Planning time : 50.830 ms
Execution time : 41.994 ms
Trigger times:
Trigger Name:Total time:Calls:Average time:
Inventory_on_invalidate_cache on Inventory 1.104 ms 1 1.104 ms
Inventory_Product_on_invalidate_cache on Inventory_Product 1.015 ms 1 1.015 ms