Openbravo Issue Tracking System - Retail Modules
View Issue Details
0036312Retail ModulesWeb POSpublic2017-06-22 12:202017-06-27 09:03
shuehner 
migueldejuana 
normalmajorhave not tried
closedfixed 
5
 
RR17Q3 
marvintm
No
0036312: Improve performance of ProducePrice masterdata loading
Main query is from ProductPrice.java

current for access of obretco_prol_product it uses the auto-created index for the unique constraint:
    "obretco_prol_product_un" UNIQUE CONSTRAINT, btree (ad_client_id, m_product_id, obretco_productlist_id)

2 Changes should be done
a.) The part ad_client_id seems functionally useless. as no data can be created for this table in ad_client_id=0 and no normal uuid for products or assortment is possible to be re-used cross-client.
So extra adding ad_client_id does not change anything.

Note: Still api-change which should be done properly.

b.) That a.) the order of the remaining columns should be swapped to be
obretco_productlist_id, m_product_id

As the login query does filter by fixed value assortment_id

That change improved query time by ca. 40%
Example improvement seen:
Testing incremental one:
- without index: 5.3s
- with index 3.3s

Testing full one:
- without: 10s
- with index: 6.3s

Note: That order change makes it impossible to use the combined index for filtering by 'only' m_product_id. However this table already has another index for m_product_id which will be used.

Note:
Apart there is single column index on obretco_productlist_id which is functionally covered by the 'new' modified index from b.)
So it could be deleted.
However reading from smaller single column index is slightly faster then multi-column index -> So some testing is needed before decising if to keep or delete that index.



Apart the query has an extra ueless 2nd join to m_pricelist_version to get the m_pricelist_id column of the resultset. That property definition should be fixed to not required the extra join.
-
Performance
depends on backport 0036348RR17Q2.2 closed migueldejuana Improve performance of ProducePrice masterdata loading 
depends on backport 0036349RR17Q1.3 closed migueldejuana Improve performance of ProducePrice masterdata loading 
related to defect 0036327 closed migueldejuana Api-change: Change obretco_prol_product_un unique constraint 
related to design defect 0037025 closed gorka_gil Perfromance problem in incremental refresh process, with product price query 
diff issue0036263retailConfig.diff (706) 2017-06-22 17:01
https://issues.openbravo.com/file_download.php?file_id=10864&type=bug
Issue History
2017-06-22 12:20shuehnerNew Issue
2017-06-22 12:20shuehnerAssigned To => Retail
2017-06-22 12:20shuehnerResolution time => 1499896800
2017-06-22 12:20shuehnerTriggers an Emergency Pack => No
2017-06-22 16:45migueldejuanaAssigned ToRetail => migueldejuana
2017-06-22 17:01migueldejuanaFile Added: issue0036263retailConfig.diff
2017-06-23 14:21migueldejuanaRelationship addedrelated to 0036327
2017-06-26 15:40hgbotCheckin
2017-06-26 15:40hgbotNote Added: 0097662
2017-06-26 15:40hgbotCheckin
2017-06-26 15:40hgbotNote Added: 0097664
2017-06-26 15:40hgbotStatusnew => resolved
2017-06-26 15:40hgbotResolutionopen => fixed
2017-06-26 15:40hgbotFixed in SCM revision => http://code.openbravo.com/erp/pmods/org.openbravo.retail.config/rev/be79de65acb9009211857ae3eb0ac27ba47ba66a [^]
2017-06-26 15:41hgbotCheckin
2017-06-26 15:41hgbotNote Added: 0097667
2017-06-26 15:41hgbotFixed in SCM revisionhttp://code.openbravo.com/erp/pmods/org.openbravo.retail.config/rev/be79de65acb9009211857ae3eb0ac27ba47ba66a [^] => http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/ff89952823e0f4431bff9894ed6b4397cba1cd75 [^]
2017-06-26 18:21shuehnerTag Attached: Performance
2017-06-26 18:34marvintmStatusresolved => new
2017-06-26 18:34marvintmResolutionfixed => open
2017-06-26 18:35marvintmStatusnew => scheduled
2017-06-26 18:35marvintmStatusscheduled => resolved
2017-06-26 18:35marvintmFixed in Version => RR17Q3
2017-06-26 18:35marvintmResolutionopen => fixed
2017-06-27 09:03marvintmReview Assigned To => marvintm
2017-06-27 09:03marvintmStatusresolved => closed
2017-10-06 14:57malsasuaRelationship addedrelated to 0037025

Notes
(0097662)
hgbot   
2017-06-26 15:40   
Repository: retail/api-checks-retail
Changeset: 26ec4b14582916b26760f3e036de9f49ed9d4afd
Author: Miguel de Juana <miguel.dejuana <at> openbravo.com>
Date: Mon Jun 26 15:40:05 2017 +0200
URL: http://code.openbravo.com/retail/api-checks-retail/rev/26ec4b14582916b26760f3e036de9f49ed9d4afd [^]

Fixed issue 0036327: Api-change: Change obretco_prol_product_un unique constraint. Approved Api change. Related to issue 36312

---
M model/modules/org.openbravo.retail.config/src-db/database/model/tables/OBRETCO_PROL_PRODUCT.xml
---
(0097664)
hgbot   
2017-06-26 15:40   
Repository: erp/pmods/org.openbravo.retail.config
Changeset: be79de65acb9009211857ae3eb0ac27ba47ba66a
Author: Miguel de Juana <miguel.dejuana <at> openbravo.com>
Date: Fri Jun 23 11:41:41 2017 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.config/rev/be79de65acb9009211857ae3eb0ac27ba47ba66a [^]

Fixed issue 0036312: Improve performance of ProducePrice masterdata loading

- current for access of obretco_prol_product it uses the auto-created index for the unique constraint:
    "obretco_prol_product_un" UNIQUE CONSTRAINT, btree (ad_client_id, m_product_id, obretco_productlist_id)

The part ad_client_id seems functionally useless. as no data can be created for this table in ad_client_id=0 and no normal uuid for products or assortment is possible to be re-used cross-client.
So extra adding ad_client_id does not change anything.

---
M src-db/database/model/tables/OBRETCO_PROL_PRODUCT.xml
---
(0097667)
hgbot   
2017-06-26 15:41   
Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: ff89952823e0f4431bff9894ed6b4397cba1cd75
Author: Miguel de Juana <miguel.dejuana <at> openbravo.com>
Date: Fri Jun 23 11:39:27 2017 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/ff89952823e0f4431bff9894ed6b4397cba1cd75 [^]

Fixed issue 0036312: Improve performance of ProducePrice masterdata loading

- remove extra useless 2nd join to m_pricelist_version to get the m_pricelist_id column of the resultset.

---
M src/org/openbravo/retail/posterminal/master/ProductPriceProperties.java
---