Openbravo Issue Tracking System - Retail Modules
View Issue Details
0042269Retail ModulesWeb POSpublic2019-11-13 12:582019-12-02 07:45
ioritzCia 
alekosmp86 
highmajoralways
closedfixed 
30Ubuntu 18.04
RR19Q1.2 
RR20Q1 
guilleaer
Gold
No
0042269: [Performance] ProductCharacteristicValue master data performance improvement
The query generated by the ProductCharacteristicValue master data refresh either incremental or full can be improved in performance.

Filtering by characteri1_.em_obpos_useonwebpos = 'Y' makes the planner to build a less efficient plan.

To take into account:
- Oracle: An in clause with more than 1000 elements is not possible in Oracle, a subselect would, but a subselect does not improve the plan. It would be quite strange to have more than 20 characteristics as em_obpos_useonwebpos = 'Y', even more to have more than 1000.
- To check if in environments with not many characteristics this does not make it perform worse. If it leaves it the same but improves cases with many characteristics it would be a nice solution to include.
Set log min duration statement of the environment accordingly (typically < 200ms) to be able to see both executions in log.
Log in WebPOS and check for the execution of the query

Original query example:
https://pastebin.com/16RFjMdi [^]

Changed query example:
https://pastebin.com/8ZPUFBwk [^]

Plan before the change:
https://explain.depesz.com/s/IO5k [^]

Plan after the change:
https://explain.depesz.com/s/sps9 [^]
Diff attached. Making a query to obtain the characteristic_ids its really fast and setting them in an in clause in the query improves the performance.

It does not improve the timing only but also the amount of information the query requires to read either from memory or disk.
Performance
diff productCharacteristicValue.diff (2,886) 2019-11-13 12:58
https://issues.openbravo.com/file_download.php?file_id=13527&type=bug
Issue History
2019-11-13 12:58ioritzCiaNew Issue
2019-11-13 12:58ioritzCiaAssigned To => Retail
2019-11-13 12:58ioritzCiaFile Added: productCharacteristicValue.diff
2019-11-13 12:58ioritzCiaOBNetwork customer => Gold
2019-11-13 12:58ioritzCiaResolution time => 1575500400
2019-11-13 12:58ioritzCiaTriggers an Emergency Pack => No
2019-11-13 12:59ioritzCiaTag Attached: Performance
2019-11-13 13:05ioritzCiaDescription Updatedbug_revision_view_page.php?rev_id=19686#r19686
2019-11-13 13:05ioritzCiaSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=19688#r19688
2019-11-13 13:05ioritzCiaDescription Updatedbug_revision_view_page.php?rev_id=19689#r19689
2019-11-13 13:07ioritzCiaProposed Solution updated
2019-11-13 13:12ioritzCiaDescription Updatedbug_revision_view_page.php?rev_id=19690#r19690
2019-11-19 15:41alekosmp86Assigned ToRetail => alekosmp86
2019-11-25 15:40hgbotCheckin
2019-11-25 15:40hgbotNote Added: 0115802
2019-11-25 15:40hgbotStatusnew => resolved
2019-11-25 15:40hgbotResolutionopen => fixed
2019-11-25 15:40hgbotFixed in SCM revision => http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/df764f0c7f467276fe632582b3e84d7f727cafe7 [^]
2019-12-02 07:45guilleaerReview Assigned To => guilleaer
2019-12-02 07:45guilleaerStatusresolved => closed
2019-12-02 07:45guilleaerFixed in Version => RR20Q1

Notes
(0115802)
hgbot   
2019-11-25 15:40   
Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: df764f0c7f467276fe632582b3e84d7f727cafe7
Author: Alejandro <alekosmp86 <at> gmail.com>
Date: Tue Nov 19 10:22:26 2019 -0500
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/df764f0c7f467276fe632582b3e84d7f727cafe7 [^]

Fixed issue 42269: ProductCharacteristicValue master data performance improvement

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