explain.depesz.com

PostgreSQL's explain analyze made readable

Result: UbCM

Settings
# exclusive inclusive rows x rows loops node
1. 10.587 71.676 ↑ 1.8 1,430 1

Sort (cost=10,000,136,024.80..10,000,136,031.34 rows=2,617 width=4,749) (actual time=71.583..71.676 rows=1,430 loops=1)

  • Sort Key: receipts_info."dateUpdated", receipts_info.id, receipt_global_claim."idClaim", "OrderSupplier".id, site_owner.id, receipt_with_products."labelOrdered", receipt_with_products."idReceiptProduct" DESC
  • Sort Method: quicksort Memory: 1,496kB
2.          

CTE sites

3. 1.960 6.902 ↓ 19.2 1,751 1

HashAggregate (cost=10,000,001,840.56..10,000,001,841.47 rows=91 width=356) (actual time=6.549..6.902 rows=1,751 loops=1)

  • Group Key: wished_site_parent_tree."idSite", wished_site_parent_tree."idSiteParent", wished_site_parent_tree."idTree", wished_site.label, wished_site."codeInternal", wished_site."extId", wished_site.params
  • Peak Memory Usage: 601 kB
4. 0.157 4.942 ↓ 19.2 1,751 1

Append (cost=52.48..10,000,001,838.97 rows=91 width=356) (actual time=0.140..4.942 rows=1,751 loops=1)

5. 1.237 4.080 ↓ 36.5 1,751 1

Nested Loop (cost=52.48..128.20 rows=48 width=130) (actual time=0.139..4.080 rows=1,751 loops=1)

6. 0.203 1.092 ↓ 36.5 1,751 1

Nested Loop (cost=52.21..111.44 rows=48 width=10) (actual time=0.132..1.092 rows=1,751 loops=1)

7. 0.002 0.123 ↑ 1.0 1 1

Limit (cost=51.93..51.93 rows=1 width=16) (actual time=0.122..0.123 rows=1 loops=1)

8. 0.010 0.121 ↑ 2.0 1 1

Sort (cost=51.93..51.93 rows=2 width=16) (actual time=0.121..0.121 rows=1 loops=1)

  • Sort Key: "Site_Parent_Tree"."idTree
  • Sort Method: quicksort Memory: 25kB
9. 0.004 0.111 ↑ 1.0 2 1

Nested Loop (cost=0.56..51.92 rows=2 width=16) (actual time=0.022..0.111 rows=2 loops=1)

10. 0.011 0.011 ↑ 1.0 1 1

Index Scan using "Right_PK" on "Right" (cost=0.28..2.30 rows=1 width=4) (actual time=0.011..0.011 rows=1 loops=1)

  • Index Cond: ("idUser" = 1)
11. 0.096 0.096 ↑ 1.0 2 1

Index Scan using "Site_Parent_Tree_PK" on "Site_Parent_Tree" (cost=0.28..49.60 rows=2 width=16) (actual time=0.008..0.096 rows=2 loops=1)

  • Index Cond: ("idSite" = "Right"."idSite")
12. 0.766 0.766 ↓ 54.7 1,751 1

Index Scan using "Site_Parent_Tree_PK" on "Site_Parent_Tree" wished_site_parent_tree (cost=0.28..59.18 rows=32 width=20) (actual time=0.008..0.766 rows=1,751 loops=1)

  • Index Cond: ("idTree" = "Site_Parent_Tree"."idTree")
  • Filter: (("leftBorder" >= "Site_Parent_Tree"."leftBorder") AND ("rightBorder" <= "Site_Parent_Tree"."rightBorder") AND (depth >= "Site_Parent_Tree".depth))
13. 1.751 1.751 ↑ 1.0 1 1,751

Index Scan using "Site_PK" on "Site" wished_site (cost=0.28..0.35 rows=1 width=124) (actual time=0.001..0.001 rows=1 loops=1,751)

  • Index Cond: (id = wished_site_parent_tree."idSite")
14. 0.007 0.705 ↓ 0.0 0 1

Hash Join (cost=10,000,000,457.95..10,000,001,709.40 rows=43 width=130) (actual time=0.705..0.705 rows=0 loops=1)

  • Hash Cond: (wished_site_parent_tree_1."idSite" = "Site".id)
15. 0.022 0.022 ↑ 3,507.0 1 1

Seq Scan on "Site_Parent_Tree" wished_site_parent_tree_1 (cost=0.00..1,235.07 rows=3,507 width=10) (actual time=0.022..0.022 rows=1 loops=1)

16. 0.001 0.676 ↓ 0.0 0 1

Hash (cost=10,000,000,455.73..10,000,000,455.73 rows=178 width=128) (actual time=0.675..0.676 rows=0 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 8kB
17. 0.001 0.675 ↓ 0.0 0 1

Nested Loop (cost=10,000,000,001.12..10,000,000,455.73 rows=178 width=128) (actual time=0.675..0.675 rows=0 loops=1)

18. 0.044 0.674 ↓ 0.0 0 1

Nested Loop (cost=10,000,000,000.84..10,000,000,273.22 rows=178 width=4) (actual time=0.674..0.674 rows=0 loops=1)

19. 0.630 0.630 ↑ 1.0 178 1

Index Scan using "Site_PK" on "Site" (cost=0.28..267.26 rows=178 width=4) (actual time=0.152..0.630 rows=178 loops=1)

  • Filter: (type = 2)
  • Rows Removed by Filter: 1,752
20. 0.000 0.000 ↓ 0.0 0 178

Materialize (cost=0.57..3.73 rows=1 width=0) (actual time=0.000..0.000 rows=0 loops=178)

21. 0.002 0.015 ↓ 0.0 0 1

Nested Loop (cost=0.57..3.73 rows=1 width=0) (actual time=0.015..0.015 rows=0 loops=1)

22. 0.005 0.005 ↑ 1.0 1 1

Index Scan using "Right_PK" on "Right" "Right_1" (cost=0.28..2.30 rows=1 width=4) (actual time=0.005..0.005 rows=1 loops=1)

  • Index Cond: ("idUser" = 1)
23. 0.008 0.008 ↓ 0.0 0 1

Index Only Scan using "Profile_Action_PK" on "Profile_Action" (cost=0.29..1.31 rows=1 width=4) (actual time=0.008..0.008 rows=0 loops=1)

  • Index Cond: (("idProfile" = "Right_1"."idProfile") AND ("idAction" = '132752970683'::bigint))
  • Heap Fetches: 0
24. 0.000 0.000 ↓ 0.0 0

Index Scan using "Site_PK" on "Site" wished_site_1 (cost=0.28..1.03 rows=1 width=124) (never executed)

  • Index Cond: (id = "Site".id)
25.          

CTE receipts_header

26. 0.013 16.201 ↑ 1.0 100 1

Limit (cost=9.51..443.07 rows=100 width=53) (actual time=16.032..16.201 rows=100 loops=1)

27. 0.064 16.188 ↑ 111.5 100 1

Incremental Sort (cost=9.51..48,365.03 rows=11,153 width=53) (actual time=16.031..16.188 rows=100 loops=1)

  • Sort Key: "Receipt"."idSiteOwner", "Receipt".umpteenth, "Receipt"."dateUpdated
  • Presorted Key: "Receipt"."idSiteOwner", "Receipt".umpteenth
  • Full-sort Groups: 4 Sort Method: quicksort Average Memory: 29kB Peak Memory: 29kB
28. 0.033 16.124 ↑ 110.4 101 1

Merge Join (cost=5.21..47,863.15 rows=11,153 width=53) (actual time=15.847..16.124 rows=101 loops=1)

  • Merge Cond: ("Receipt"."idSiteOwner" = sites."idSite")
29. 7.987 7.987 ↑ 1,098.1 101 1

Index Scan using "Receipt_idSiteOwner_umpteenth_UK" on "Receipt" (cost=0.42..47,413.79 rows=110,913 width=53) (actual time=7.743..7.987 rows=101 loops=1)

  • Filter: ("dateUpdated" > ('2020-01-01 10:42:43+01'::timestamp with time zone)::timestamp without time zone)
  • Rows Removed by Filter: 8,765
30. 0.342 8.104 ↓ 1.1 103 1

Sort (cost=4.78..5.01 rows=91 width=4) (actual time=8.098..8.104 rows=103 loops=1)

  • Sort Key: sites."idSite
  • Sort Method: quicksort Memory: 131kB
31. 7.762 7.762 ↓ 19.2 1,751 1

CTE Scan on sites (cost=0.00..1.82 rows=91 width=4) (actual time=6.552..7.762 rows=1,751 loops=1)

32.          

CTE receipts_info

33. 1.219 21.281 ↓ 1.1 100 1

Nested Loop Left Join (cost=4.07..451.16 rows=91 width=636) (actual time=16.918..21.281 rows=100 loops=1)

34. 0.044 17.862 ↓ 1.1 100 1

Nested Loop (cost=3.79..217.06 rows=91 width=584) (actual time=16.780..17.862 rows=100 loops=1)

35. 0.114 17.618 ↓ 1.1 100 1

Nested Loop (cost=3.51..125.38 rows=91 width=547) (actual time=16.770..17.618 rows=100 loops=1)

36. 0.082 17.404 ↓ 1.1 100 1

Nested Loop (cost=3.23..93.15 rows=91 width=510) (actual time=16.763..17.404 rows=100 loops=1)

37. 0.084 17.022 ↓ 1.1 100 1

Hash Join (cost=2.96..6.24 rows=91 width=468) (actual time=16.746..17.022 rows=100 loops=1)

  • Hash Cond: (receipts_header_1."idSiteOwner" = site_owner_1."idSite")
38. 16.234 16.234 ↑ 1.0 100 1

CTE Scan on receipts_header receipts_header_1 (cost=0.00..2.00 rows=100 width=122) (actual time=16.033..16.234 rows=100 loops=1)

39. 0.391 0.704 ↓ 19.2 1,751 1

Hash (cost=1.82..1.82 rows=91 width=350) (actual time=0.704..0.704 rows=1,751 loops=1)

  • Buckets: 2,048 (originally 1024) Batches: 1 (originally 1) Memory Usage: 305kB
40. 0.313 0.313 ↓ 19.2 1,751 1

CTE Scan on sites site_owner_1 (cost=0.00..1.82 rows=91 width=350) (actual time=0.001..0.313 rows=1,751 loops=1)

41. 0.300 0.300 ↑ 1.0 1 100

Index Scan using "Supplier_PK" on "Supplier" (cost=0.28..0.96 rows=1 width=46) (actual time=0.003..0.003 rows=1 loops=100)

  • Index Cond: (id = receipts_header_1."idSupplier")
42. 0.100 0.100 ↑ 1.0 1 100

Index Scan using "Supplier_PK" on "Supplier" parentsupplier (cost=0.28..0.35 rows=1 width=41) (actual time=0.001..0.001 rows=1 loops=100)

  • Index Cond: (id = "Supplier"."idSupplierParent")
43. 0.200 0.200 ↑ 1.0 1 100

Index Scan using "User_PK" on "User" (cost=0.28..1.01 rows=1 width=41) (actual time=0.002..0.002 rows=1 loops=100)

  • Index Cond: (id = receipts_header_1."idUserResponsible")
44. 2.200 2.200 ↑ 1.0 1 100

Index Scan using "Supplier_Site_UK" on "Supplier_Site" (cost=0.28..2.06 rows=1 width=12) (actual time=0.022..0.022 rows=1 loops=100)

  • Index Cond: (("idSite" = receipts_header_1."idSiteOwner") AND ("idSupplier" = receipts_header_1."idSupplier"))
45.          

CTE receipt_global_claim

46. 0.004 0.269 ↑ 7.5 12 1

Unique (cost=258.11..258.56 rows=90 width=24) (actual time=0.265..0.269 rows=12 loops=1)

47. 0.010 0.265 ↑ 7.5 12 1

Sort (cost=258.11..258.33 rows=90 width=24) (actual time=0.264..0.265 rows=12 loops=1)

  • Sort Key: receipts_header_2.id, "Claim_1".version DESC
  • Sort Method: quicksort Memory: 25kB
48. 0.006 0.255 ↑ 7.5 12 1

Nested Loop (cost=0.58..255.18 rows=90 width=24) (actual time=0.071..0.255 rows=12 loops=1)

49. 0.056 0.169 ↑ 8.7 16 1

Nested Loop (cost=0.29..209.00 rows=139 width=8) (actual time=0.022..0.169 rows=16 loops=1)

50. 0.013 0.013 ↑ 1.0 100 1

CTE Scan on receipts_header receipts_header_2 (cost=0.00..2.00 rows=100 width=4) (actual time=0.001..0.013 rows=100 loops=1)

51. 0.100 0.100 ↓ 0.0 0 100

Index Scan using "Receipt_Claim_idReceipt" on "Receipt_Claim" (cost=0.29..2.06 rows=1 width=8) (actual time=0.001..0.001 rows=0 loops=100)

  • Index Cond: ("idReceipt" = receipts_header_2.id)
52. 0.080 0.080 ↑ 1.0 1 16

Index Scan using "Claim_PK" on "Claim" "Claim_1" (cost=0.29..0.33 rows=1 width=20) (actual time=0.005..0.005 rows=1 loops=16)

  • Index Cond: (id = "Receipt_Claim"."idClaim")
  • Filter: (status = ANY ('{0,2,5,6,7}'::smallint[]))
  • Rows Removed by Filter: 0
53.          

CTE receipt_with_products

54. 1.934 33.051 ↑ 4.1 1,204 1

Nested Loop Left Join (cost=4,195.98..39,655.78 rows=4,937 width=522) (actual time=4.277..33.051 rows=1,204 loops=1)

55. 0.513 29.913 ↑ 4.1 1,204 1

Hash Left Join (cost=4,195.69..38,106.43 rows=4,937 width=285) (actual time=4.258..29.913 rows=1,204 loops=1)

  • Hash Cond: (ordered_supplier_product."idStorageUnit" = ordered_unit_for_stock_transfer.id)
  • Join Filter: (receipts_info_1."fromStockTransfer" IS TRUE)
  • Rows Removed by Join Filter: 1,108
56. 0.576 28.415 ↑ 4.1 1,204 1

Hash Left Join (cost=3,147.59..37,045.36 rows=4,937 width=273) (actual time=3.259..28.415 rows=1,204 loops=1)

  • Hash Cond: (ordered_supplier_product."idBillingUnit" = ordered_unit.id)
  • Join Filter: (receipts_info_1."fromStockTransfer" IS FALSE)
57. 0.334 26.834 ↑ 4.1 1,204 1

Nested Loop Left Join (cost=2,099.49..35,984.29 rows=4,937 width=261) (actual time=2.240..26.834 rows=1,204 loops=1)

58. 0.537 24.092 ↑ 4.1 1,204 1

Nested Loop Left Join (cost=2,099.07..33,818.38 rows=4,937 width=172) (actual time=2.232..24.092 rows=1,204 loops=1)

59. 0.647 21.147 ↑ 4.1 1,204 1

Nested Loop Left Join (cost=2,098.64..31,618.46 rows=4,937 width=168) (actual time=2.224..21.147 rows=1,204 loops=1)

60. 1.104 18.092 ↑ 4.1 1,204 1

Nested Loop Left Join (cost=2,098.21..29,332.27 rows=4,937 width=148) (actual time=2.212..18.092 rows=1,204 loops=1)

61. 0.518 14.580 ↑ 4.1 1,204 1

Hash Left Join (cost=2,097.77..27,010.33 rows=4,937 width=144) (actual time=2.198..14.580 rows=1,204 loops=1)

  • Hash Cond: (delivered_supplier_product."idStorageUnit" = delivered_unit_for_stock_transfer.id)
  • Join Filter: (receipts_info_1."fromStockTransfer" IS TRUE)
  • Rows Removed by Join Filter: 1,204
62. 0.536 13.064 ↑ 4.1 1,204 1

Hash Left Join (cost=1,049.67..25,949.26 rows=4,937 width=132) (actual time=1.186..13.064 rows=1,204 loops=1)

  • Hash Cond: (delivered_supplier_product."idBillingUnit" = delivered_unit.id)
  • Join Filter: (receipts_info_1."fromStockTransfer" IS FALSE)
63. 0.169 11.402 ↑ 4.1 1,204 1

Nested Loop Left Join (cost=1.57..24,888.18 rows=4,937 width=120) (actual time=0.048..11.402 rows=1,204 loops=1)

  • Join Filter: ((receipts_info_1."isReceiptPricesFromPricelist" IS TRUE) AND (receipts_info_1."hasBeenManuallyModified" IS FALSE) AND (receipts_info_1.status < '5'::smallint) AND ("SupplierProductAllowedFlat"."allowedSites" @> ARRAY[receipts_info_1."idSiteOwner"]) AND ("SupplierProductAllowedFlat"."allowedSuppliers" @> ARRAY[receipts_info_1."idSupplier"]) AND ("SupplierProductAllowedFlat"."dateValid" @> receipts_info_1."dateReceivedTs"))
  • Rows Removed by Join Filter: 124
64. 0.967 8.825 ↑ 4.1 1,204 1

Nested Loop (cost=1.14..4,052.93 rows=4,937 width=128) (actual time=0.038..8.825 rows=1,204 loops=1)

65. 0.486 5.450 ↑ 4.1 1,204 1

Nested Loop (cost=0.85..2,528.26 rows=4,937 width=131) (actual time=0.027..5.450 rows=1,204 loops=1)

66. 0.389 1.352 ↑ 4.1 1,204 1

Nested Loop (cost=0.43..363.05 rows=4,937 width=47) (actual time=0.015..1.352 rows=1,204 loops=1)

67. 0.063 0.063 ↓ 1.1 100 1

CTE Scan on receipts_info receipts_info_1 (cost=0.00..1.82 rows=91 width=21) (actual time=0.001..0.063 rows=100 loops=1)

68. 0.900 0.900 ↑ 4.5 12 100

Index Scan using "Receipt_Product_idReceipt" on "Receipt_Product" (cost=0.43..3.43 rows=54 width=30) (actual time=0.004..0.009 rows=12 loops=100)

  • Index Cond: ("idReceipt" = receipts_info_1.id)
69. 3.612 3.612 ↑ 1.0 1 1,204

Index Scan using "SupplierProduct_PK" on "SupplierProduct" delivered_supplier_product (cost=0.42..0.44 rows=1 width=88) (actual time=0.003..0.003 rows=1 loops=1,204)

  • Index Cond: (id = "Receipt_Product"."idSupplierProductDelivered")
70. 2.408 2.408 ↑ 1.0 1 1,204

Index Scan using "Product_PK" on "Product" delivered_product (cost=0.29..0.31 rows=1 width=5) (actual time=0.002..0.002 rows=1 loops=1,204)

  • Index Cond: ("idElement" = delivered_supplier_product."idProduct")
71. 2.408 2.408 ↓ 0.0 0 1,204

Index Scan using "SupplierProductAllowedFlat_idSupplierProduct" on "SupplierProductAllowedFlat" (cost=0.43..2.20 rows=101 width=101) (actual time=0.002..0.002 rows=0 loops=1,204)

  • Index Cond: ("idSupplierProduct" = "Receipt_Product"."idSupplierProductDelivered")
72. 0.432 1.126 ↑ 1.0 3,038 1

Hash (cost=1,010.13..1,010.13 rows=3,038 width=20) (actual time=1.125..1.126 rows=3,038 loops=1)

  • Buckets: 4,096 Batches: 1 Memory Usage: 194kB
73. 0.694 0.694 ↑ 1.0 3,038 1

Index Scan using "Unit_PK" on "Unit" delivered_unit (cost=0.28..1,010.13 rows=3,038 width=20) (actual time=0.012..0.694 rows=3,038 loops=1)

74. 0.433 0.998 ↑ 1.0 3,038 1

Hash (cost=1,010.13..1,010.13 rows=3,038 width=20) (actual time=0.998..0.998 rows=3,038 loops=1)

  • Buckets: 4,096 Batches: 1 Memory Usage: 194kB
75. 0.565 0.565 ↑ 1.0 3,038 1

Index Scan using "Unit_PK" on "Unit" delivered_unit_for_stock_transfer (cost=0.28..1,010.13 rows=3,038 width=20) (actual time=0.010..0.565 rows=3,038 loops=1)

76. 2.408 2.408 ↑ 1.0 1 1,204

Index Scan using "OrderSupplier_Product_Receipt_Product_idReceiptProduct" on "OrderSupplier_Product_Receipt_Product" (cost=0.43..0.46 rows=1 width=8) (actual time=0.002..0.002 rows=1 loops=1,204)

  • Index Cond: ("idReceiptProduct" = "Receipt_Product".id)
77. 2.408 2.408 ↑ 1.0 1 1,204

Index Scan using "OrderSupplier_Product_PK" on "OrderSupplier_Product" (cost=0.43..0.46 rows=1 width=24) (actual time=0.002..0.002 rows=1 loops=1,204)

  • Index Cond: (id = "OrderSupplier_Product_Receipt_Product"."idOrderSupplierProduct")
78. 2.408 2.408 ↑ 1.0 1 1,204

Index Scan using "OrderSupplier_PK" on "OrderSupplier" "OrderSupplier_1" (cost=0.42..0.45 rows=1 width=8) (actual time=0.002..0.002 rows=1 loops=1,204)

  • Index Cond: (id = "OrderSupplier_Product"."idOrderSupplier")
79. 2.408 2.408 ↑ 1.0 1 1,204

Index Scan using "SupplierProduct_PK" on "SupplierProduct" ordered_supplier_product (cost=0.42..0.44 rows=1 width=93) (actual time=0.002..0.002 rows=1 loops=1,204)

  • Index Cond: (id = "OrderSupplier_Product"."idSupplierProduct")
80. 0.421 1.005 ↑ 1.0 3,038 1

Hash (cost=1,010.13..1,010.13 rows=3,038 width=20) (actual time=1.005..1.005 rows=3,038 loops=1)

  • Buckets: 4,096 Batches: 1 Memory Usage: 194kB
81. 0.584 0.584 ↑ 1.0 3,038 1

Index Scan using "Unit_PK" on "Unit" ordered_unit (cost=0.28..1,010.13 rows=3,038 width=20) (actual time=0.010..0.584 rows=3,038 loops=1)

82. 0.417 0.985 ↑ 1.0 3,038 1

Hash (cost=1,010.13..1,010.13 rows=3,038 width=20) (actual time=0.985..0.985 rows=3,038 loops=1)

  • Buckets: 4,096 Batches: 1 Memory Usage: 194kB
83. 0.568 0.568 ↑ 1.0 3,038 1

Index Scan using "Unit_PK" on "Unit" ordered_unit_for_stock_transfer (cost=0.28..1,010.13 rows=3,038 width=20) (actual time=0.012..0.568 rows=3,038 loops=1)

84. 1.204 1.204 ↑ 1.0 1 1,204

Index Scan using "Product_PK" on "Product" ordered_product (cost=0.29..0.31 rows=1 width=5) (actual time=0.001..0.001 rows=1 loops=1,204)

  • Index Cond: ("idElement" = ordered_supplier_product."idProduct")
85. 1.212 61.089 ↑ 1.8 1,430 1

Hash Left Join (cost=739.67..903.19 rows=2,617 width=4,749) (actual time=58.554..61.089 rows=1,430 loops=1)

  • Hash Cond: (receipt_with_products."idReceiptProduct" = receipt_with_products_claim."idReceiptProductFromProductClaim")
86. 1.070 29.226 ↑ 1.8 1,430 1

Hash Right Join (cost=374.56..517.98 rows=2,617 width=4,694) (actual time=27.889..29.226 rows=1,430 loops=1)

  • Hash Cond: (receipt_with_products."idReceiptFromProduct" = receipts_info.id)
87. 4.560 4.560 ↑ 4.1 1,204 1

CTE Scan on receipt_with_products (cost=0.00..98.74 rows=4,937 width=2,250) (actual time=4.280..4.560 rows=1,204 loops=1)

88. 0.122 23.596 ↓ 1.0 109 1

Hash (cost=373.23..373.23 rows=106 width=2,444) (actual time=23.596..23.596 rows=109 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 72kB
89. 0.085 23.474 ↓ 1.0 109 1

Hash Left Join (cost=7.01..373.23 rows=106 width=2,444) (actual time=21.864..23.474 rows=109 loops=1)

  • Hash Cond: (receipts_info.id = receipt_global_claim."idReceiptFromGlobalClaim")
90. 0.092 23.110 ↓ 1.0 109 1

Hash Right Join (cost=4.08..368.86 rows=106 width=2,395) (actual time=21.577..23.110 rows=109 loops=1)

  • Hash Cond: (receipts_header.id = receipts_info.id)
91. 0.075 1.503 ↑ 1.2 98 1

Nested Loop (cost=1.13..364.40 rows=117 width=148) (actual time=0.052..1.503 rows=98 loops=1)

92. 0.081 1.232 ↑ 1.2 98 1

Nested Loop (cost=0.85..329.85 rows=117 width=28) (actual time=0.036..1.232 rows=98 loops=1)

93. 0.047 0.367 ↑ 1.2 98 1

Nested Loop (cost=0.42..244.25 rows=117 width=8) (actual time=0.014..0.367 rows=98 loops=1)

94. 0.020 0.020 ↑ 1.0 100 1

CTE Scan on receipts_header (cost=0.00..2.00 rows=100 width=4) (actual time=0.000..0.020 rows=100 loops=1)

95. 0.300 0.300 ↑ 1.0 1 100

Index Scan using "OrderSupplier_Receipt_idReceipt" on "OrderSupplier_Receipt" (cost=0.42..2.41 rows=1 width=8) (actual time=0.003..0.003 rows=1 loops=100)

  • Index Cond: ("idReceipt" = receipts_header.id)
96. 0.784 0.784 ↑ 1.0 1 98

Index Scan using "OrderSupplier_PK" on "OrderSupplier" (cost=0.42..0.73 rows=1 width=24) (actual time=0.008..0.008 rows=1 loops=98)

  • Index Cond: (id = "OrderSupplier_Receipt"."idOrderSupplier")
97. 0.196 0.196 ↑ 1.0 1 98

Index Scan using "Site_PK" on "Site" site_owner (cost=0.28..0.30 rows=1 width=124) (actual time=0.002..0.002 rows=1 loops=98)

  • Index Cond: (id = "OrderSupplier"."idSiteOwner")
98. 0.048 21.515 ↓ 1.1 100 1

Hash (cost=1.82..1.82 rows=91 width=2,247) (actual time=21.515..21.515 rows=100 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 49kB
99. 21.467 21.467 ↓ 1.1 100 1

CTE Scan on receipts_info (cost=0.00..1.82 rows=91 width=2,247) (actual time=16.924..21.467 rows=100 loops=1)

100. 0.005 0.279 ↑ 7.5 12 1

Hash (cost=1.80..1.80 rows=90 width=49) (actual time=0.279..0.279 rows=12 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
101. 0.274 0.274 ↑ 7.5 12 1

CTE Scan on receipt_global_claim (cost=0.00..1.80 rows=90 width=49) (actual time=0.267..0.274 rows=12 loops=1)

102. 0.006 30.651 ↓ 1.5 17 1

Hash (cost=364.98..364.98 rows=11 width=27) (actual time=30.651..30.651 rows=17 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
103. 0.005 30.645 ↓ 1.5 17 1

Subquery Scan on receipt_with_products_claim (cost=364.81..364.98 rows=11 width=27) (actual time=30.637..30.645 rows=17 loops=1)

104. 0.004 30.640 ↓ 1.5 17 1

Unique (cost=364.81..364.87 rows=11 width=31) (actual time=30.635..30.640 rows=17 loops=1)

105. 0.019 30.636 ↓ 1.5 17 1

Sort (cost=364.81..364.84 rows=11 width=31) (actual time=30.634..30.636 rows=17 loops=1)

  • Sort Key: receipt_with_products_1."idReceiptProduct", "Claim".version DESC
  • Sort Method: quicksort Memory: 26kB
106. 0.238 30.617 ↓ 1.5 17 1

Hash Join (cost=247.26..364.62 rows=11 width=31) (actual time=1.819..30.617 rows=17 loops=1)

  • Hash Cond: (receipt_with_products_1."idReceiptProduct" = "Claim_Product"."idReceiptProduct")
107. 30.277 30.277 ↑ 4.1 1,204 1

CTE Scan on receipt_with_products receipt_with_products_1 (cost=0.00..98.74 rows=4,937 width=4) (actual time=0.001..30.277 rows=1,204 loops=1)

108. 0.006 0.102 ↑ 16.2 17 1

Hash (cost=243.81..243.81 rows=276 width=31) (actual time=0.102..0.102 rows=17 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 10kB
109. 0.011 0.096 ↑ 16.2 17 1

Nested Loop (cost=0.71..243.81 rows=276 width=31) (actual time=0.021..0.096 rows=17 loops=1)

  • Join Filter: (receipt_global_claim_1."idClaim" = "Claim_Product"."idClaim")
110. 0.009 0.037 ↑ 7.5 12 1

Nested Loop (cost=0.29..195.70 rows=90 width=18) (actual time=0.010..0.037 rows=12 loops=1)

111. 0.004 0.004 ↑ 7.5 12 1

CTE Scan on receipt_global_claim receipt_global_claim_1 (cost=0.00..1.80 rows=90 width=4) (actual time=0.001..0.004 rows=12 loops=1)

112. 0.024 0.024 ↑ 1.0 1 12

Index Scan using "Claim_PK" on "Claim" (cost=0.29..2.15 rows=1 width=14) (actual time=0.002..0.002 rows=1 loops=12)

  • Index Cond: (id = receipt_global_claim_1."idClaim")
113. 0.048 0.048 ↑ 3.0 1 12

Index Scan using "Claim_Product_UK" on "Claim_Product" (cost=0.42..0.50 rows=3 width=21) (actual time=0.004..0.004 rows=1 loops=12)

  • Index Cond: ("idClaim" = "Claim".id)
Planning time : 13.792 ms
Execution time : 72.561 ms