explain.depesz.com

PostgreSQL's explain analyze made readable

Result: V4LE

Settings
# exclusive inclusive rows x rows loops node
1. 288.036 291.110 ↑ 1.0 27 1

CTE Scan on mostsold ms (cost=43,962.49..48,345.94 rows=27 width=546) (actual time=287.973..291.110 rows=27 loops=1)

  • Output: ms.product_id, ms.name, COALESCE((SubPlan 3), (SubPlan 5), '0'::numeric), COALESCE((SubPlan 7), (SubPlan 9), '0'::numeric), (SubPlan 10), (SubPlan 11)
  • Buffers: shared hit=6,781
2.          

CTE mostsold

3. 0.049 287.701 ↑ 1.0 27 1

Limit (cost=43,962.42..43,962.49 rows=27 width=94) (actual time=287.633..287.701 rows=27 loops=1)

  • Output: a.product_id, a.name, (sum(a.amount)), a.selectionproduct_id, a.packageproduct, a.validselectionproduct
  • Buffers: shared hit=6,254
4. 0.733 287.652 ↑ 37.0 27 1

Sort (cost=43,962.42..43,964.92 rows=1,000 width=94) (actual time=287.629..287.652 rows=27 loops=1)

  • Output: a.product_id, a.name, (sum(a.amount)), a.selectionproduct_id, a.packageproduct, a.validselectionproduct
  • Sort Key: (sum(a.amount)) DESC
  • Sort Method: top-N heapsort Memory: 29kB
  • Buffers: shared hit=6,254
5. 1.901 286.919 ↑ 1.9 535 1

GroupAggregate (cost=43,903.65..43,933.65 rows=1,000 width=94) (actual time=284.223..286.919 rows=535 loops=1)

  • Output: a.product_id, a.name, sum(a.amount), a.selectionproduct_id, a.packageproduct, a.validselectionproduct
  • Group Key: a.product_id, a.name, a.selectionproduct_id, a.packageproduct, a.validselectionproduct
  • Buffers: shared hit=6,254
6. 3.964 285.018 ↑ 1.0 1,000 1

Sort (cost=43,903.65..43,906.15 rows=1,000 width=67) (actual time=284.198..285.018 rows=1,000 loops=1)

  • Output: a.product_id, a.name, a.selectionproduct_id, a.packageproduct, a.validselectionproduct, a.amount
  • Sort Key: a.product_id, a.name, a.selectionproduct_id, a.packageproduct, a.validselectionproduct
  • Sort Method: quicksort Memory: 152kB
  • Buffers: shared hit=6,254
7. 2.900 281.054 ↑ 1.0 1,000 1

Subquery Scan on a (cost=1,004.00..43,853.82 rows=1,000 width=67) (actual time=17.639..281.054 rows=1,000 loops=1)

  • Output: a.product_id, a.name, a.selectionproduct_id, a.packageproduct, a.validselectionproduct, a.amount
  • Buffers: shared hit=6,254
8. 2.805 278.154 ↑ 1.0 1,000 1

Limit (cost=1,004.00..43,843.82 rows=1,000 width=75) (actual time=17.635..278.154 rows=1,000 loops=1)

  • Output: p.product_id, p.name, sr.amount, ps.selectionproduct_id, (COALESCE(mppt.ispackage, false)), ((((sp.removetime > now()) OR (sp.removetime IS NULL)) AND ((sp.disabledtime > now()) OR (sp.disabledtime IS NULL)))), s."timestamp
  • Buffers: shared hit=6,254
9. 42.545 275.349 ↑ 46.6 1,000 1

Nested Loop Left Join (cost=1,004.00..1,997,682.32 rows=46,608 width=75) (actual time=17.630..275.349 rows=1,000 loops=1)

  • Output: p.product_id, p.name, sr.amount, ps.selectionproduct_id, COALESCE(mppt.ispackage, false), (((sp.removetime > now()) OR (sp.removetime IS NULL)) AND ((sp.disabledtime > now()) OR (sp.disabledtime IS NULL))), s."timestamp
  • Inner Unique: true
  • Join Filter: (mppt.producttype_id = ppt.main_producttype_id)
  • Rows Removed by Join Filter: 27,924
  • Buffers: shared hit=6,254
10. 35.486 194.804 ↑ 46.6 1,000 1

Nested Loop Left Join (cost=1,004.00..1,978,290.60 rows=46,608 width=93) (actual time=17.424..194.804 rows=1,000 loops=1)

  • Output: p.product_id, p.name, ps.selectionproduct_id, sp.removetime, sp.disabledtime, sr.amount, s."timestamp", ppt.main_producttype_id
  • Inner Unique: true
  • Join Filter: (pp.producttype_id = ppt.producttype_id)
  • Rows Removed by Join Filter: 22,964
  • Buffers: shared hit=6,253
11. 5.054 128.318 ↑ 46.6 1,000 1

Nested Loop Left Join (cost=1,004.00..1,962,850.28 rows=46,608 width=105) (actual time=17.253..128.318 rows=1,000 loops=1)

  • Output: p.product_id, p.name, ps.selectionproduct_id, sp.removetime, sp.disabledtime, sr.amount, s."timestamp", pp.producttype_id
  • Inner Unique: true
  • Buffers: shared hit=6,252
12. 7.262 122.264 ↑ 46.6 1,000 1

Nested Loop Left Join (cost=1,003.57..1,793,020.46 rows=46,608 width=89) (actual time=17.242..122.264 rows=1,000 loops=1)

  • Output: p.product_id, p.name, ps.selectionproduct_id, sp.removetime, sp.disabledtime, sr.amount, s."timestamp
  • Join Filter: (cp.product_id = p.product_id)
  • Rows Removed by Join Filter: 2,000
  • Buffers: shared hit=6,236
13. 4.202 111.002 ↑ 46.6 1,000 1

Nested Loop Left Join (cost=1,003.57..1,791,621.19 rows=46,608 width=89) (actual time=17.192..111.002 rows=1,000 loops=1)

  • Output: p.product_id, p.name, ps.selectionproduct_id, sp.removetime, sp.disabledtime, sr.amount, s."timestamp
  • Inner Unique: true
  • Buffers: shared hit=6,235
14. 4.392 104.800 ↑ 46.6 1,000 1

Nested Loop Left Join (cost=1,003.15..1,621,791.38 rows=46,608 width=73) (actual time=17.180..104.800 rows=1,000 loops=1)

  • Output: p.product_id, p.name, ps.selectionproduct_id, sr.amount, s."timestamp
  • Buffers: shared hit=6,219
15. 31.266 94.408 ↑ 46.6 1,000 1

Nested Loop (cost=1,002.87..1,507,810.10 rows=46,608 width=57) (actual time=17.158..94.408 rows=1,000 loops=1)

  • Output: p.product_id, p.name, sr.amount, s."timestamp
  • Join Filter: (pt.producttype_id = p.producttype_id)
  • Rows Removed by Join Filter: 18,105
  • Buffers: shared hit=4,214
16. 0.000 36.986 ↑ 56.4 1,006 1

Nested Loop (cost=1,001.30..1,491,636.28 rows=56,740 width=73) (actual time=16.915..36.986 rows=1,006 loops=1)

  • Output: p.product_id, p.name, p.producttype_id, sr.amount, s."timestamp
  • Inner Unique: true
  • Buffers: shared hit=4,212
17. 0.000 31.551 ↑ 70.5 1,006 1

Gather Merge (cost=1,000.88..1,306,088.51 rows=70,938 width=29) (actual time=16.841..31.551 rows=1,006 loops=1)

  • Output: sr.amount, sr.product_id, s."timestamp
  • Workers Planned: 1
  • Workers Launched: 1
  • Buffers: shared hit=3,295 read=21
18. 5.194 70.536 ↑ 55.9 746 2 / 2

Nested Loop (cost=0.86..1,297,107.97 rows=41,728 width=29) (actual time=0.142..70.536 rows=746 loops=2)

  • Output: sr.amount, sr.product_id, s."timestamp
  • Buffers: shared hit=3,295 read=21
  • Worker 0: actual time=0.216..139.749 rows=1,415 loops=1
  • Buffers: shared hit=3,107 read=21
19. 40.042 40.042 ↑ 52.0 288 2 / 2

Parallel Index Scan Backward using "IX_sale_branch_id_timestamp" on "company2de759bc-3fce-11e3-ac31-5b2986f46e71".sale s (cost=0.43..49,664.34 rows=14,964 width=24) (actual time=0.047..40.042 rows=288 loops=2)

  • Output: s.sale_id, s.cashier_id, s.user_id, s.branch_id, s.sum, s.topay, s.customer_id, s.note, s.log_id, s.onaccount, s.receiver_company_id, s."timestamp", s.onhold, s.moneystorage_id, s.saletype_id, s.receiptnumber, s.roundoff, s.returned, s.customername, s.errorsale_id, s.correctedsale_id, s.sellername, s.reference, s.cashiernumber, s.customerextra, s.discount, s.discountpercent, s.discountpercentprimary, s.closed, s.roundoffledgeraccount_id, s.paidinvoice_id, s.cutreceiptproductname, s.modifiessale_id, s.showcustomername, s.ismanualdiscountonly, s.contact2, s.contact3, s.contact4, s.contact5, s.contact1, s.showproductcode, s.invoiceactor_id, s.parentsale_id, s.receipttemplate_id, s.waybill_id, s.saleprogram_id, s.removedtime, s.checkoutreference, s.salestate_id, s.taxfreetype_id, s.checkoutinfo, s.vatstatus_id, s.loyaltycardnumber, s.loyaltysystem_id, s.offlinereceiptnumber, s.referraltemplate_id, s.showvat, s.language_id, s.extrainfo, s.customergroups, s.template_id, s.customerorder
  • Index Cond: (s.branch_id = '971aa24a-dc34-4477-b039-8dc8a20f07f4'::uuid)
  • Buffers: shared hit=560 read=10
  • Worker 0: actual time=0.065..79.940 rows=545 loops=1
  • Buffers: shared hit=540 read=10
20. 25.300 25.300 ↑ 21.7 3 575 / 2

Index Scan using salerow_sale_id_idx on "company2de759bc-3fce-11e3-ac31-5b2986f46e71".salerow sr (cost=0.43..82.71 rows=65 width=37) (actual time=0.074..0.088 rows=3 loops=575)

  • Output: sr."row", sr.sale_id, sr.old_product_id, sr.user_id, sr.amount, sr.sum, sr."timestamp", sr.stockevent_id, sr.producer_id, sr.unitprice, sr.vatpercent, sr.vat_id, sr.producerbranch_id, sr.dynamicname, sr.producttype_id, sr.owner_company_id, sr.salerow_id, sr.isadjustment, sr.iseditable, sr.saleinvoice_id, sr.discount, sr.discountpercent, sr.discountpercentprimary, sr.originalprice, sr.note, sr.salediscount, sr.vatledgeraccount_id, sr.producttypeledgeraccount_id, sr.averagepurchasetotal, sr.stock_id, sr.cancelstockevent_id, sr.primaryproductgroup_id, sr.total, sr.vat, sr.invoice_id, sr.saleofferprice_id, sr.offerprice_id, sr.offerdiscount, sr.saleofferdiscount, sr.ismanualdiscountonly, sr.mainsalerow_id, sr.taxfreeledgeraccount_id, sr.margintaxledgeraccount_id, sr.old_selectionproduct_id, sr.saleorderrow_id, sr.customer_id, sr.warrantyperiod, sr.accountproductstarttime, sr.accountproductendtime, sr.isdelivered, sr.doinventory, sr.productpackagerow_id, sr.deliverydate, sr.originalsalerow_id, sr.modifiedtime, sr.istaxfree, sr.vatstatus_id, sr.ispaymenttermcost, sr.isdeliverymethodcost, sr.productstock_id, sr.manufacturerproduct_id, sr.product_id, sr.selectionproduct_id, sr.isinvoicecost, sr.alertkey, sr.averagecosttotal, sr.printname, sr.customergroups, sr.productgroups
  • Index Cond: (sr.sale_id = s.sale_id)
  • Buffers: shared hit=2,735 read=11
  • Worker 0: actual time=0.078..0.092 rows=3 loops=545
  • Buffers: shared hit=2,567 read=11
21. 11.066 11.066 ↑ 1.0 1 1,006

Index Scan using product_pkey on "company2de759bc-3fce-11e3-ac31-5b2986f46e71".product p (cost=0.42..2.62 rows=1 width=60) (actual time=0.011..0.011 rows=1 loops=1,006)

  • Output: p.product_id, p.code, p.oldcode, p.name, p.ean, p.vat_id, p.producttype_id, p.description, p.removetime, p.disabledtime, p.availableonline, p.superproduct_id, p.measure_id, p.size, p.log_id, p.variantparent_id, p.valid, p.accountproduct_id, p.defaultlanguage_id, p.a24phone, p.resttime, p.colorcode, p.colorcodetext, p.deliverygroup_id, p.medicalproduct_id, p.lastpurchaseaccount_id, p.viewonly, p.visibleontehplay, p.warrantyperiod, p.billingaddressrequired, p.allowcreditpayment, p.productstate_id, p.un_id, p.unweight, p.firesafetyrequired, p.a24_reservation_advance, p.saleperiod_id, p.createtime, p.modifytime, p.creator_id, p.modifier_id, p.mergeproduct_id, p.presystem_id, p.allowgiftcardbillingrefund, p.visibleontehplayuntilend, p.a24_hide_price, p.immaterialdelivery, p.serialnumbertype_id, p.extrasize, p.webstorestarttime, p.webstoreendtime, p.sellwithedit, p.seasonalaccountproductstartdate, p.seasonalaccountproductenddate, p.isseasonalaccountproduct, p.system_id, p.onlinepayment
  • Index Cond: (p.product_id = sr.product_id)
  • Filter: (((p.disabledtime IS NULL) OR (p.disabledtime > now())) AND ((p.removetime IS NULL) OR (p.removetime > now())))
  • Buffers: shared hit=4,024
22. 25.910 26.156 ↑ 1.0 19 1,006

Materialize (cost=1.57..2.96 rows=19 width=16) (actual time=0.002..0.026 rows=19 loops=1,006)

  • Output: pt.producttype_id
  • Buffers: shared hit=2
23. 0.097 0.246 ↑ 1.0 19 1

Hash Join (cost=1.57..2.87 rows=19 width=16) (actual time=0.137..0.246 rows=19 loops=1)

  • Output: pt.producttype_id
  • Inner Unique: true
  • Hash Cond: (pt.main_producttype_id = mpt.producttype_id)
  • Buffers: shared hit=2
24. 0.047 0.047 ↑ 1.0 23 1

Seq Scan on "company2de759bc-3fce-11e3-ac31-5b2986f46e71".producttype pt (cost=0.00..1.23 rows=23 width=20) (actual time=0.011..0.047 rows=23 loops=1)

  • Output: pt.producttype_id, pt.key, pt.main_producttype_id, pt.log_id, pt.ledgeraccount_id
  • Buffers: shared hit=1
25. 0.048 0.102 ↑ 1.0 23 1

Hash (cost=1.28..1.28 rows=23 width=4) (actual time=0.101..0.102 rows=23 loops=1)

  • Output: mpt.producttype_id
  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
  • Buffers: shared hit=1
26. 0.054 0.054 ↑ 1.0 23 1

Seq Scan on main.producttype mpt (cost=0.00..1.28 rows=23 width=4) (actual time=0.009..0.054 rows=23 loops=1)

  • Output: mpt.producttype_id
  • Filter: mpt.issaleable
  • Rows Removed by Filter: 5
  • Buffers: shared hit=1
27. 6.000 6.000 ↓ 0.0 0 1,000

Index Scan using "IX_product_productselection_productselection" on "company2de759bc-3fce-11e3-ac31-5b2986f46e71".productselection ps (cost=0.28..2.44 rows=1 width=32) (actual time=0.006..0.006 rows=0 loops=1,000)

  • Output: ps.selectionproduct_id, ps.product_id, ps.modifier_id, ps.modifiedtime, ps.isdefault, ps."order", ps.amount, ps.productselection_id
  • Index Cond: (p.product_id = ps.product_id)
  • Filter: ps.isdefault
  • Buffers: shared hit=2,005
28. 2.000 2.000 ↓ 0.0 0 1,000

Index Scan using product_pkey on "company2de759bc-3fce-11e3-ac31-5b2986f46e71".product sp (cost=0.42..3.64 rows=1 width=32) (actual time=0.002..0.002 rows=0 loops=1,000)

  • Output: sp.product_id, sp.code, sp.oldcode, sp.name, sp.ean, sp.vat_id, sp.producttype_id, sp.description, sp.removetime, sp.disabledtime, sp.availableonline, sp.superproduct_id, sp.measure_id, sp.size, sp.log_id, sp.variantparent_id, sp.valid, sp.accountproduct_id, sp.defaultlanguage_id, sp.a24phone, sp.resttime, sp.colorcode, sp.colorcodetext, sp.deliverygroup_id, sp.medicalproduct_id, sp.lastpurchaseaccount_id, sp.viewonly, sp.visibleontehplay, sp.warrantyperiod, sp.billingaddressrequired, sp.allowcreditpayment, sp.productstate_id, sp.un_id, sp.unweight, sp.firesafetyrequired, sp.a24_reservation_advance, sp.saleperiod_id, sp.createtime, sp.modifytime, sp.creator_id, sp.modifier_id, sp.mergeproduct_id, sp.presystem_id, sp.allowgiftcardbillingrefund, sp.visibleontehplayuntilend, sp.a24_hide_price, sp.immaterialdelivery, sp.serialnumbertype_id, sp.extrasize, sp.webstorestarttime, sp.webstoreendtime, sp.sellwithedit, sp.seasonalaccountproductstartdate, sp.seasonalaccountproductenddate, sp.isseasonalaccountproduct, sp.system_id, sp.onlinepayment
  • Index Cond: (sp.product_id = ps.selectionproduct_id)
  • Buffers: shared hit=16
29. 3.987 4.000 ↑ 1.0 2 1,000

Materialize (cost=0.00..1.03 rows=2 width=16) (actual time=0.001..0.004 rows=2 loops=1,000)

  • Output: cp.product_id
  • Buffers: shared hit=1
30. 0.013 0.013 ↑ 1.0 2 1

Seq Scan on "company2de759bc-3fce-11e3-ac31-5b2986f46e71".company_product cp (cost=0.00..1.02 rows=2 width=16) (actual time=0.008..0.013 rows=2 loops=1)

  • Output: cp.product_id
  • Buffers: shared hit=1
31. 1.000 1.000 ↓ 0.0 0 1,000

Index Scan using product_pkey on "company2de759bc-3fce-11e3-ac31-5b2986f46e71".product pp (cost=0.42..3.64 rows=1 width=32) (actual time=0.001..0.001 rows=0 loops=1,000)

  • Output: pp.product_id, pp.code, pp.oldcode, pp.name, pp.ean, pp.vat_id, pp.producttype_id, pp.description, pp.removetime, pp.disabledtime, pp.availableonline, pp.superproduct_id, pp.measure_id, pp.size, pp.log_id, pp.variantparent_id, pp.valid, pp.accountproduct_id, pp.defaultlanguage_id, pp.a24phone, pp.resttime, pp.colorcode, pp.colorcodetext, pp.deliverygroup_id, pp.medicalproduct_id, pp.lastpurchaseaccount_id, pp.viewonly, pp.visibleontehplay, pp.warrantyperiod, pp.billingaddressrequired, pp.allowcreditpayment, pp.productstate_id, pp.un_id, pp.unweight, pp.firesafetyrequired, pp.a24_reservation_advance, pp.saleperiod_id, pp.createtime, pp.modifytime, pp.creator_id, pp.modifier_id, pp.mergeproduct_id, pp.presystem_id, pp.allowgiftcardbillingrefund, pp.visibleontehplayuntilend, pp.a24_hide_price, pp.immaterialdelivery, pp.serialnumbertype_id, pp.extrasize, pp.webstorestarttime, pp.webstoreendtime, pp.sellwithedit, pp.seasonalaccountproductstartdate, pp.seasonalaccountproductenddate, pp.isseasonalaccountproduct, pp.system_id, pp.onlinepayment
  • Index Cond: (ps.selectionproduct_id = pp.product_id)
  • Buffers: shared hit=16
32. 30.955 31.000 ↑ 1.0 23 1,000

Materialize (cost=0.00..1.34 rows=23 width=20) (actual time=0.001..0.031 rows=23 loops=1,000)

  • Output: ppt.producttype_id, ppt.main_producttype_id
  • Buffers: shared hit=1
33. 0.045 0.045 ↑ 1.0 23 1

Seq Scan on "company2de759bc-3fce-11e3-ac31-5b2986f46e71".producttype ppt (cost=0.00..1.23 rows=23 width=20) (actual time=0.006..0.045 rows=23 loops=1)

  • Output: ppt.producttype_id, ppt.main_producttype_id
  • Buffers: shared hit=1
34. 37.940 38.000 ↑ 1.0 28 1,000

Materialize (cost=0.00..1.42 rows=28 width=5) (actual time=0.001..0.038 rows=28 loops=1,000)

  • Output: mppt.ispackage, mppt.producttype_id
  • Buffers: shared hit=1
35. 0.060 0.060 ↑ 1.0 28 1

Seq Scan on main.producttype mppt (cost=0.00..1.28 rows=28 width=5) (actual time=0.007..0.060 rows=28 loops=1)

  • Output: mppt.ispackage, mppt.producttype_id
  • Buffers: shared hit=1
36.          

SubPlan (for CTE Scan)

37. 0.000 1.215 ↑ 1.0 1 27

Limit (cost=37.67..37.68 rows=1 width=14) (actual time=0.044..0.045 rows=1 loops=27)

  • Output: price.taxprice, price.starttime
  • Buffers: shared hit=218
38.          

Initplan (for Limit)

39. 0.054 0.378 ↓ 0.0 0 27

Limit (cost=8.93..8.94 rows=1 width=17) (actual time=0.014..0.014 rows=0 loops=27)

  • Output: ps_1.selectionproduct_id, ps_1.isdefault
  • Buffers: shared hit=54
40. 0.081 0.324 ↓ 0.0 0 27

Sort (cost=8.93..8.94 rows=1 width=17) (actual time=0.012..0.012 rows=0 loops=27)

  • Output: ps_1.selectionproduct_id, ps_1.isdefault
  • Sort Key: ps_1.isdefault DESC
  • Sort Method: quicksort Memory: 25kB
  • Buffers: shared hit=54
41. 0.054 0.243 ↓ 0.0 0 27

Nested Loop (cost=0.84..8.92 rows=1 width=17) (actual time=0.009..0.009 rows=0 loops=27)

  • Output: ps_1.selectionproduct_id, ps_1.isdefault
  • Inner Unique: true
  • Buffers: shared hit=54
42. 0.054 0.189 ↓ 0.0 0 27

Nested Loop (cost=0.71..8.74 rows=1 width=33) (actual time=0.007..0.007 rows=0 loops=27)

  • Output: ps_1.selectionproduct_id, ps_1.isdefault, psp.producttype_id
  • Inner Unique: true
  • Buffers: shared hit=54
43. 0.135 0.135 ↓ 0.0 0 27

Index Scan using "IX_product_productselection_productselection" on "company2de759bc-3fce-11e3-ac31-5b2986f46e71".productselection ps_1 (cost=0.28..4.30 rows=1 width=17) (actual time=0.005..0.005 rows=0 loops=27)

  • Output: ps_1.selectionproduct_id, ps_1.product_id, ps_1.modifier_id, ps_1.modifiedtime, ps_1.isdefault, ps_1."order", ps_1.amount, ps_1.productselection_id
  • Index Cond: (ps_1.product_id = ms.product_id)
  • Buffers: shared hit=54
44. 0.000 0.000 ↓ 0.0 0

Index Scan using product_pkey on "company2de759bc-3fce-11e3-ac31-5b2986f46e71".product psp (cost=0.42..4.44 rows=1 width=32) (never executed)

  • Output: psp.product_id, psp.code, psp.oldcode, psp.name, psp.ean, psp.vat_id, psp.producttype_id, psp.description, psp.removetime, psp.disabledtime, psp.availableonline, psp.superproduct_id, psp.measure_id, psp.size, psp.log_id, psp.variantparent_id, psp.valid, psp.accountproduct_id, psp.defaultlanguage_id, psp.a24phone, psp.resttime, psp.colorcode, psp.colorcodetext, psp.deliverygroup_id, psp.medicalproduct_id, psp.lastpurchaseaccount_id, psp.viewonly, psp.visibleontehplay, psp.warrantyperiod, psp.billingaddressrequired, psp.allowcreditpayment, psp.productstate_id, psp.un_id, psp.unweight, psp.firesafetyrequired, psp.a24_reservation_advance, psp.saleperiod_id, psp.createtime, psp.modifytime, psp.creator_id, psp.modifier_id, psp.mergeproduct_id, psp.presystem_id, psp.allowgiftcardbillingrefund, psp.visibleontehplayuntilend, psp.a24_hide_price, psp.immaterialdelivery, psp.serialnumbertype_id, psp.extrasize, psp.webstorestarttime, psp.webstoreendtime, psp.sellwithedit, psp.seasonalaccountproductstartdate, psp.seasonalaccountproductenddate, psp.isseasonalaccountproduct, psp.system_id, psp.onlinepayment
  • Index Cond: (psp.product_id = ps_1.selectionproduct_id)
45. 0.000 0.000 ↓ 0.0 0

Index Scan using producttype_pkey on "company2de759bc-3fce-11e3-ac31-5b2986f46e71".producttype pspt (cost=0.14..0.16 rows=1 width=16) (never executed)

  • Output: pspt.producttype_id, pspt.key, pspt.main_producttype_id, pspt.log_id, pspt.ledgeraccount_id
  • Index Cond: (pspt.producttype_id = psp.producttype_id)
  • Filter: ((pspt.key)::text = 'producttype_selectionsaleproduct'::text)
46. 0.162 1.107 ↑ 6.0 1 27

Sort (cost=28.74..28.75 rows=6 width=14) (actual time=0.041..0.041 rows=1 loops=27)

  • Output: price.taxprice, price.starttime
  • Sort Key: price.starttime DESC
  • Sort Method: quicksort Memory: 25kB
  • Buffers: shared hit=218
47. 0.540 0.945 ↑ 3.0 2 27

Result (cost=0.43..28.71 rows=6 width=14) (actual time=0.027..0.035 rows=2 loops=27)

  • Output: price.taxprice, price.starttime
  • One-Time Filter: ((NOT ms.packageproduct) AND ms.validselectionproduct)
  • Buffers: shared hit=218
48. 0.405 0.405 ↑ 3.0 2 27

Index Scan using price_product_id_idx on "company2de759bc-3fce-11e3-ac31-5b2986f46e71".price (cost=0.43..28.71 rows=6 width=14) (actual time=0.009..0.015 rows=2 loops=27)

  • Output: price.price_id, price.starttime, price.product_id, price.price, price.log_id, price.taxprice, price.taxpriceprimary, price.user_id, price.note, price.purchaseprice, price.modifiedtime, price.total, price.vatincluded, price.amount, price.orderamount, price.suggestedretailprice, price.pricelist_id, price.parentprice_id, price.vat_id, price.marginpercentage
  • Index Cond: (price.product_id = COALESCE($10, ms.product_id))
  • Filter: ((price.pricelist_id IS NULL) AND (price.starttime <= now()))
  • Rows Removed by Filter: 2
  • Buffers: shared hit=164
49. 0.000 0.078 ↓ 0.0 0 1

Limit (cost=37.67..37.68 rows=1 width=14) (actual time=0.077..0.078 rows=0 loops=1)

  • Output: price_1.taxprice, price_1.starttime
  • Buffers: shared hit=5
50.          

Initplan (for Limit)

51. 0.003 0.046 ↓ 0.0 0 1

Limit (cost=8.93..8.94 rows=1 width=17) (actual time=0.045..0.046 rows=0 loops=1)

  • Output: ps_2.selectionproduct_id, ps_2.isdefault
  • Buffers: shared hit=2
52. 0.015 0.043 ↓ 0.0 0 1

Sort (cost=8.93..8.94 rows=1 width=17) (actual time=0.043..0.043 rows=0 loops=1)

  • Output: ps_2.selectionproduct_id, ps_2.isdefault
  • Sort Key: ps_2.isdefault DESC
  • Sort Method: quicksort Memory: 25kB
  • Buffers: shared hit=2
53. 0.003 0.028 ↓ 0.0 0 1

Nested Loop (cost=0.84..8.92 rows=1 width=17) (actual time=0.027..0.028 rows=0 loops=1)

  • Output: ps_2.selectionproduct_id, ps_2.isdefault
  • Inner Unique: true
  • Buffers: shared hit=2
54. 0.003 0.025 ↓ 0.0 0 1

Nested Loop (cost=0.71..8.74 rows=1 width=33) (actual time=0.024..0.025 rows=0 loops=1)

  • Output: ps_2.selectionproduct_id, ps_2.isdefault, psp_1.producttype_id
  • Inner Unique: true
  • Buffers: shared hit=2
55. 0.022 0.022 ↓ 0.0 0 1

Index Scan using "IX_product_productselection_productselection" on "company2de759bc-3fce-11e3-ac31-5b2986f46e71".productselection ps_2 (cost=0.28..4.30 rows=1 width=17) (actual time=0.021..0.022 rows=0 loops=1)

  • Output: ps_2.selectionproduct_id, ps_2.product_id, ps_2.modifier_id, ps_2.modifiedtime, ps_2.isdefault, ps_2."order", ps_2.amount, ps_2.productselection_id
  • Index Cond: (ps_2.product_id = ms.product_id)
  • Buffers: shared hit=2
56. 0.000 0.000 ↓ 0.0 0

Index Scan using product_pkey on "company2de759bc-3fce-11e3-ac31-5b2986f46e71".product psp_1 (cost=0.42..4.44 rows=1 width=32) (never executed)

  • Output: psp_1.product_id, psp_1.code, psp_1.oldcode, psp_1.name, psp_1.ean, psp_1.vat_id, psp_1.producttype_id, psp_1.description, psp_1.removetime, psp_1.disabledtime, psp_1.availableonline, psp_1.superproduct_id, psp_1.measure_id, psp_1.size, psp_1.log_id, psp_1.variantparent_id, psp_1.valid, psp_1.accountproduct_id, psp_1.defaultlanguage_id, psp_1.a24phone, psp_1.resttime, psp_1.colorcode, psp_1.colorcodetext, psp_1.deliverygroup_id, psp_1.medicalproduct_id, psp_1.lastpurchaseaccount_id, psp_1.viewonly, psp_1.visibleontehplay, psp_1.warrantyperiod, psp_1.billingaddressrequired, psp_1.allowcreditpayment, psp_1.productstate_id, psp_1.un_id, psp_1.unweight, psp_1.firesafetyrequired, psp_1.a24_reservation_advance, psp_1.saleperiod_id, psp_1.createtime, psp_1.modifytime, psp_1.creator_id, psp_1.modifier_id, psp_1.mergeproduct_id, psp_1.presystem_id, psp_1.allowgiftcardbillingrefund, psp_1.visibleontehplayuntilend, psp_1.a24_hide_price, psp_1.immaterialdelivery, psp_1.serialnumbertype_id, psp_1.extrasize, psp_1.webstorestarttime, psp_1.webstoreendtime, psp_1.sellwithedit, psp_1.seasonalaccountproductstartdate, psp_1.seasonalaccountproductenddate, psp_1.isseasonalaccountproduct, psp_1.system_id, psp_1.onlinepayment
  • Index Cond: (psp_1.product_id = ps_2.selectionproduct_id)
57. 0.000 0.000 ↓ 0.0 0

Index Scan using producttype_pkey on "company2de759bc-3fce-11e3-ac31-5b2986f46e71".producttype pspt_1 (cost=0.14..0.16 rows=1 width=16) (never executed)

  • Output: pspt_1.producttype_id, pspt_1.key, pspt_1.main_producttype_id, pspt_1.log_id, pspt_1.ledgeraccount_id
  • Index Cond: (pspt_1.producttype_id = psp_1.producttype_id)
  • Filter: ((pspt_1.key)::text = 'producttype_selectionsaleproduct'::text)
58. 0.063 0.076 ↓ 0.0 0 1

Sort (cost=28.74..28.75 rows=6 width=14) (actual time=0.075..0.076 rows=0 loops=1)

  • Output: price_1.taxprice, price_1.starttime
  • Sort Key: price_1.starttime DESC
  • Sort Method: quicksort Memory: 25kB
  • Buffers: shared hit=5
59. 0.013 0.013 ↓ 0.0 0 1

Index Scan using price_product_id_idx on "company2de759bc-3fce-11e3-ac31-5b2986f46e71".price price_1 (cost=0.43..28.71 rows=6 width=14) (actual time=0.013..0.013 rows=0 loops=1)

  • Output: price_1.taxprice, price_1.starttime
  • Index Cond: (price_1.product_id = COALESCE($16, ms.product_id))
  • Filter: ((price_1.pricelist_id IS NULL) AND (price_1.starttime <= now()))
  • Buffers: shared hit=3
60. 0.000 0.891 ↑ 1.0 1 27

Limit (cost=33.05..33.06 rows=1 width=13) (actual time=0.033..0.033 rows=1 loops=27)

  • Output: price_2.amount, price_2.starttime
  • Buffers: shared hit=218
61.          

Initplan (for Limit)

62. 0.054 0.243 ↓ 0.0 0 27

Limit (cost=4.31..4.31 rows=1 width=17) (actual time=0.009..0.009 rows=0 loops=27)

  • Output: ps_3.selectionproduct_id, ps_3.isdefault
  • Buffers: shared hit=54
63. 0.108 0.189 ↓ 0.0 0 27

Sort (cost=4.31..4.31 rows=1 width=17) (actual time=0.007..0.007 rows=0 loops=27)

  • Output: ps_3.selectionproduct_id, ps_3.isdefault
  • Sort Key: ps_3.isdefault DESC
  • Sort Method: quicksort Memory: 25kB
  • Buffers: shared hit=54
64. 0.081 0.081 ↓ 0.0 0 27

Index Scan using "IX_product_productselection_productselection" on "company2de759bc-3fce-11e3-ac31-5b2986f46e71".productselection ps_3 (cost=0.28..4.30 rows=1 width=17) (actual time=0.003..0.003 rows=0 loops=27)

  • Output: ps_3.selectionproduct_id, ps_3.isdefault
  • Index Cond: (ps_3.product_id = ms.product_id)
  • Buffers: shared hit=54
65. 0.189 0.837 ↑ 6.0 1 27

Sort (cost=28.74..28.75 rows=6 width=13) (actual time=0.031..0.031 rows=1 loops=27)

  • Output: price_2.amount, price_2.starttime
  • Sort Key: price_2.starttime DESC, price_2.amount
  • Sort Method: quicksort Memory: 25kB
  • Buffers: shared hit=218
66. 0.432 0.648 ↑ 3.0 2 27

Result (cost=0.43..28.71 rows=6 width=13) (actual time=0.017..0.024 rows=2 loops=27)

  • Output: price_2.amount, price_2.starttime
  • One-Time Filter: ((NOT ms.packageproduct) AND ms.validselectionproduct)
  • Buffers: shared hit=218
67. 0.216 0.216 ↑ 3.0 2 27

Index Scan using price_product_id_idx on "company2de759bc-3fce-11e3-ac31-5b2986f46e71".price price_2 (cost=0.43..28.71 rows=6 width=13) (actual time=0.005..0.008 rows=2 loops=27)

  • Output: price_2.price_id, price_2.starttime, price_2.product_id, price_2.price, price_2.log_id, price_2.taxprice, price_2.taxpriceprimary, price_2.user_id, price_2.note, price_2.purchaseprice, price_2.modifiedtime, price_2.total, price_2.vatincluded, price_2.amount, price_2.orderamount, price_2.suggestedretailprice, price_2.pricelist_id, price_2.parentprice_id, price_2.vat_id, price_2.marginpercentage
  • Index Cond: (price_2.product_id = COALESCE($18, ms.product_id))
  • Filter: ((price_2.pricelist_id IS NULL) AND (price_2.starttime <= now()))
  • Rows Removed by Filter: 2
  • Buffers: shared hit=164
68. 0.000 0.053 ↓ 0.0 0 1

Limit (cost=33.05..33.06 rows=1 width=13) (actual time=0.052..0.053 rows=0 loops=1)

  • Output: price_3.amount, price_3.starttime
  • Buffers: shared hit=5
69.          

Initplan (for Limit)

70. 0.003 0.025 ↓ 0.0 0 1

Limit (cost=4.31..4.31 rows=1 width=17) (actual time=0.024..0.025 rows=0 loops=1)

  • Output: ps_4.selectionproduct_id, ps_4.isdefault
  • Buffers: shared hit=2
71. 0.012 0.022 ↓ 0.0 0 1

Sort (cost=4.31..4.31 rows=1 width=17) (actual time=0.022..0.022 rows=0 loops=1)

  • Output: ps_4.selectionproduct_id, ps_4.isdefault
  • Sort Key: ps_4.isdefault DESC
  • Sort Method: quicksort Memory: 25kB
  • Buffers: shared hit=2
72. 0.010 0.010 ↓ 0.0 0 1

Index Scan using "IX_product_productselection_productselection" on "company2de759bc-3fce-11e3-ac31-5b2986f46e71".productselection ps_4 (cost=0.28..4.30 rows=1 width=17) (actual time=0.010..0.010 rows=0 loops=1)

  • Output: ps_4.selectionproduct_id, ps_4.isdefault
  • Index Cond: (ps_4.product_id = ms.product_id)
  • Buffers: shared hit=2
73. 0.039 0.051 ↓ 0.0 0 1

Sort (cost=28.74..28.75 rows=6 width=13) (actual time=0.050..0.051 rows=0 loops=1)

  • Output: price_3.amount, price_3.starttime
  • Sort Key: price_3.starttime DESC, price_3.amount
  • Sort Method: quicksort Memory: 25kB
  • Buffers: shared hit=5
74. 0.012 0.012 ↓ 0.0 0 1

Index Scan using price_product_id_idx on "company2de759bc-3fce-11e3-ac31-5b2986f46e71".price price_3 (cost=0.43..28.71 rows=6 width=13) (actual time=0.011..0.012 rows=0 loops=1)

  • Output: price_3.amount, price_3.starttime
  • Index Cond: (price_3.product_id = COALESCE($22, ms.product_id))
  • Filter: ((price_3.pricelist_id IS NULL) AND (price_3.starttime <= now()))
  • Buffers: shared hit=3
75. 0.054 0.351 ↓ 0.0 0 27

Limit (cost=6.62..6.63 rows=1 width=20) (actual time=0.013..0.013 rows=0 loops=27)

  • Output: pf.file_id, pf.picturerank
  • Buffers: shared hit=27
76. 0.162 0.297 ↓ 0.0 0 27

Sort (cost=6.62..6.63 rows=3 width=20) (actual time=0.010..0.011 rows=0 loops=27)

  • Output: pf.file_id, pf.picturerank
  • Sort Key: pf.picturerank
  • Sort Method: quicksort Memory: 25kB
  • Buffers: shared hit=27
77. 0.081 0.135 ↓ 0.0 0 27

Bitmap Heap Scan on "company2de759bc-3fce-11e3-ac31-5b2986f46e71".product_file pf (cost=2.21..6.61 rows=3 width=20) (actual time=0.005..0.005 rows=0 loops=27)

  • Output: pf.file_id, pf.picturerank
  • Recheck Cond: (pf.product_id = ms.product_id)
  • Filter: pf.ispicture
  • Buffers: shared hit=27
78. 0.054 0.054 ↓ 0.0 0 27

Bitmap Index Scan on product_file_pkey (cost=0.00..2.21 rows=3 width=0) (actual time=0.002..0.002 rows=0 loops=27)

  • Index Cond: ((pf.product_id = ms.product_id) AND (pf.ispicture = true))
  • Buffers: shared hit=27
79. 0.054 0.486 ↓ 0.0 0 27

Limit (cost=14.23..14.24 rows=1 width=120) (actual time=0.018..0.018 rows=0 loops=27)

  • Output: me.url, pf_1.picturerank, f.variant
  • Buffers: shared hit=54
80. 0.135 0.432 ↓ 0.0 0 27

Sort (cost=14.23..14.24 rows=1 width=120) (actual time=0.016..0.016 rows=0 loops=27)

  • Output: me.url, pf_1.picturerank, f.variant
  • Sort Key: pf_1.picturerank, f.variant DESC
  • Sort Method: quicksort Memory: 25kB
  • Buffers: shared hit=54
81. 0.027 0.297 ↓ 0.0 0 27

Nested Loop (cost=0.30..14.22 rows=1 width=120) (actual time=0.011..0.011 rows=0 loops=27)

  • Output: me.url, pf_1.picturerank, f.variant
  • Buffers: shared hit=54
82. 0.135 0.270 ↓ 0.0 0 27

Nested Loop (cost=0.14..7.86 rows=2 width=132) (actual time=0.009..0.010 rows=0 loops=27)

  • Output: f.variant, f.file_id, me.url
  • Inner Unique: true
  • Buffers: shared hit=54
83. 0.081 0.081 ↑ 1.0 1 27

Seq Scan on "company2de759bc-3fce-11e3-ac31-5b2986f46e71".media me (cost=0.00..1.01 rows=1 width=100) (actual time=0.002..0.003 rows=1 loops=27)

  • Output: me.media_id, me.name, me.size, me.mime, me.creator_id, me.createdtime, me.modifier_id, me.modifiedtime, me.allowuser_id, me.ispublic, me.description, me.filename, me.removedtime, me.reference_old, me.isbillable, me.url, me.reference
  • Filter: me.ispublic
  • Buffers: shared hit=27
84. 0.054 0.054 ↓ 0.0 0 27

Index Scan using "IX_media_file_file" on "company2de759bc-3fce-11e3-ac31-5b2986f46e71".file f (cost=0.14..4.17 rows=1 width=64) (actual time=0.002..0.002 rows=0 loops=27)

  • Output: f.file_id, f.name, f.description, f.log_id, f.filetype_id, f.media_id, f.attachment, f.variant, f.tempkey
  • Index Cond: (f.media_id = me.media_id)
  • Filter: ((f.variant = 'small'::text) OR (f.variant = 'original'::text))
  • Buffers: shared hit=27
85. 0.000 0.000 ↓ 0.0 0

Index Scan using product_file_pkey on "company2de759bc-3fce-11e3-ac31-5b2986f46e71".product_file pf_1 (cost=0.15..3.17 rows=1 width=20) (never executed)

  • Output: pf_1.product_id, pf_1.file_id, pf_1.picturerank, pf_1.ispicture
  • Index Cond: ((pf_1.product_id = ms.product_id) AND (pf_1.file_id = f.file_id))
Planning time : 22.455 ms
Execution time : 303.138 ms