Project:
View Issue Details[ Jump to Notes ] | [ Issue History ] [ Print ] | |||||||
ID | ||||||||
0042385 | ||||||||
Type | Category | Severity | Reproducibility | Date Submitted | Last Update | |||
defect | [Retail Modules] Web POS | major | have not tried | 2019-11-25 11:02 | 2019-12-09 14:59 | |||
Reporter | ALopetegui | View Status | public | |||||
Assigned To | rqueralta | |||||||
Priority | immediate | Resolution | fixed | Fixed in Version | RR20Q1 | |||
Status | closed | Fix in branch | Fixed in SCM revision | 344327c0b6d7 | ||||
Projection | none | ETA | none | Target Version | ||||
OS | Any | Database | Any | Java version | ||||
OS Version | Database version | Ant version | ||||||
Product Version | SCM revision | |||||||
Merge Request Status | ||||||||
Review Assigned To | marvintm | |||||||
OBNetwork customer | Gold | |||||||
Support ticket | ||||||||
Regression level | ||||||||
Regression date | ||||||||
Regression introduced in release | ||||||||
Regression introduced by commit | ||||||||
Triggers an Emergency Pack | No | |||||||
Summary | 0042385: Performance improvement in PaidReceipts query | |||||||
Description | Performance issue in PaidReceipts query, when loading payment method for the financial account related to the payments of the order. The problem of the query is that first finds all the payment methods in all financial account of all the terminals, and then have a sub-select for payments of the order to filter it. In Big customer the query takes 200ms ans is executed 30.000 times by day | |||||||
Steps To Reproduce | Find and load a Tickets in a database with high volumes | |||||||
Proposed Solution | The solution is to change the order of the query, first find payments of the order, and then only find those payment methods. With this improvement the query takes 10 times less time, and reads 3 times less from disk or memory. Attached, diff of solution. | |||||||
Tags | No tags attached. | |||||||
Attached Files | ![]() ![]() | |||||||
![]() |
|||||||||||||||
|
![]() |
|
(0115795) guilleaer (viewer) 2019-11-25 12:27 edited on: 2019-11-25 12:27 |
Patch reviewed by me. Now passing try |
(0115817) guilleaer (viewer) 2019-11-26 10:01 |
After pass try one test failed retail.pack.selenium.tests.cashmanagement.I40876_VerifyOnlyOnePayMethodShownIfSharesFinAcct [attached image with the problem] It seems that the fix done for issue 40876 needs to be reapplied (in a correct way) to maintain the performance improvement but also to cover this case. |
(0115883) ALopetegui (viewer) 2019-11-27 13:41 edited on: 2019-11-27 13:41 |
There are another two places where that hql code is repeated, So it's also necessary also to replace them: https://code.openbravo.com/erp/pmods/org.openbravo.retail.digitalcoupons/file/tip/src/org/openbravo/retail/digitalcoupons/process/DigitalCouponsPaidReceiptsPaymentsTypeHook.java#l35 [^] https://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/file/tip/src/org/openbravo/retail/posterminal/Invoices.java#l196Invoices.java [^] (this is the same but for invoiceid instead of orderid) |
(0115887) ALopetegui (viewer) 2019-11-27 13:54 |
The are two different results depending if the order has payments or not: If yes: Old query: 1ms -> https://explain.depesz.com/s/7S4Z [^] New query: 22ms -> https://explain.depesz.com/s/i5zt [^] If not: Old Query: 200ms -> https://explain.depesz.com/s/Eg3oL [^] New query: 19ms -> https://explain.depesz.com/s/P0s [^] That happens because if there is no payments in the old query the heavy part is not executed, but if yes it's very slow. However if we add a new index: New query takes only 1ms in both cases -> https://explain.depesz.com/s/QBjS [^] Proposed index: create index obpos_app_fin_account on OBPOS_APP_PAYMENT (fin_financial_account_id); |
(0116129) hgbot (developer) 2019-12-06 20:34 |
Repository: erp/pmods/org.openbravo.retail.posterminal Changeset: 344327c0b6d79a1d1ff3fd60879bc377d104936a Author: Guillermo Alvarez de Eulate <guillermo.alvarez <at> openbravo.com> Date: Wed Dec 04 15:23:59 2019 -0500 URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/344327c0b6d79a1d1ff3fd60879bc377d104936a [^] Fixed issue 42385: Performance improvement in PaidReceipts query Improve performance in paid Receipt --- M src/org/openbravo/retail/posterminal/PaidReceipts.java --- |
(0116130) hgbot (developer) 2019-12-06 20:34 |
Repository: erp/pmods/org.openbravo.retail.posterminal Changeset: 386b15cdffb4e30cb73c0182275eff8cabe25236 Author: Rafael Queralta <rafaelcuba81 <at> gmail.com> Date: Thu Dec 05 16:43:31 2019 -0500 URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/386b15cdffb4e30cb73c0182275eff8cabe25236 [^] Related to issue 42385: Performance improvement in PaidReceipts query - Readapted issue 40876 according to the solution of issue 42385 and added a new index to improve the query --- M src-db/database/model/tables/OBPOS_APP_PAYMENT.xml M src/org/openbravo/retail/posterminal/Invoices.java M src/org/openbravo/retail/posterminal/PaidReceipts.java --- |
(0116150) hgbot (developer) 2019-12-09 12:39 |
Repository: erp/pmods/org.openbravo.retail.digitalcoupons Changeset: 147fe13c2ce22345182ee031450add2e5bbd83fa Author: Rafael Queralta <rafaelcuba81 <at> gmail.com> Date: Mon Dec 09 06:34:12 2019 -0500 URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.digitalcoupons/rev/147fe13c2ce22345182ee031450add2e5bbd83fa [^] Related to issue 42385: Performance improvement in PaidReceipts query - Replaced the query of this module by the same query that was improved in posterminal module --- M src/org/openbravo/retail/digitalcoupons/process/DigitalCouponsPaidReceiptsPaymentsTypeHook.java --- |
![]() |
|||
Date Modified | Username | Field | Change |
2019-11-25 11:02 | ALopetegui | New Issue | |
2019-11-25 11:02 | ALopetegui | Assigned To | => Retail |
2019-11-25 11:02 | ALopetegui | File Added: improvePerformancePaidReceipts_pi.diff | |
2019-11-25 11:02 | ALopetegui | OBNetwork customer | => Gold |
2019-11-25 11:02 | ALopetegui | Triggers an Emergency Pack | => No |
2019-11-25 12:27 | guilleaer | Note Added: 0115795 | |
2019-11-25 12:27 | guilleaer | Note Edited: 0115795 | View Revisions |
2019-11-26 10:01 | guilleaer | Note Added: 0115817 | |
2019-11-26 10:01 | guilleaer | File Added: 2019112609:52:57.png | |
2019-11-26 10:01 | guilleaer | File Deleted: 2019112609:52:57.png | |
2019-11-26 10:02 | guilleaer | File Added: 2019112610:01:56.png | |
2019-11-26 10:02 | guilleaer | Relationship added | depends on 0040876 |
2019-11-26 10:02 | guilleaer | Assigned To | Retail => rqueralta |
2019-11-27 13:41 | ALopetegui | Note Added: 0115883 | |
2019-11-27 13:41 | ALopetegui | Note Edited: 0115883 | View Revisions |
2019-11-27 13:54 | ALopetegui | Note Added: 0115887 | |
2019-12-06 20:34 | hgbot | Checkin | |
2019-12-06 20:34 | hgbot | Note Added: 0116129 | |
2019-12-06 20:34 | hgbot | Status | new => resolved |
2019-12-06 20:34 | hgbot | Resolution | open => fixed |
2019-12-06 20:34 | hgbot | Fixed in SCM revision | => http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/344327c0b6d79a1d1ff3fd60879bc377d104936a [^] |
2019-12-06 20:34 | hgbot | Checkin | |
2019-12-06 20:34 | hgbot | Note Added: 0116130 | |
2019-12-07 08:11 | ranjith_qualiantech_com | Relationship added | related to 0037653 |
2019-12-09 12:39 | hgbot | Checkin | |
2019-12-09 12:39 | hgbot | Note Added: 0116150 | |
2019-12-09 14:59 | marvintm | Review Assigned To | => marvintm |
2019-12-09 14:59 | marvintm | Status | resolved => closed |
2019-12-09 14:59 | marvintm | Fixed in Version | => RR20Q1 |
Copyright © 2000 - 2009 MantisBT Group |