Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0056426Openbravo ERPZ. Otherspublic2024-09-10 16:012024-10-04 16:19
william_vermersch 
kousalya_r 
normalminorhave not tried
closedfixed 
5
 
PR25Q1 
Core
No
0056426: Computed column in Financial Account screen is not optimized (screen is taking a long time to load)
The column "last reconciliation balance" is making the screen really long to load when you have a lot of reconciliations linked to you financial accounts.
Have a lot of reconciliations on one (or more) financial accounts.
Go to the Financial Account screen.
It seems that using the "HAVING" in the query computing the value is the cause of the issue (column "9DA1E5CA5A25476C9764CCBEC70E3E36").

Original query:

select
      max(rec.endingbalance)
    from
      fin_reconciliation rec
    where
      rec.fin_financial_account_id = fin_financ0_.fin_financial_account_id
      and exists (
        select
          1
        from
          fin_reconciliation fr
        where
          fr.processed = 'Y'
          and fr.fin_financial_account_id = fin_financ0_.fin_financial_account_id
        having
          rec.dateto = max(fr.dateto)
      )

Potential optimization (running in ms, instead of s):

select
      max(rec.endingbalance)
    from
      fin_reconciliation rec
    where
      rec.fin_financial_account_id = fin_financ0_.fin_financial_account_id
      and rec.dateto = (
        select
          max(fr.dateto)
        from
          fin_reconciliation fr
        where
          fr.processed = 'Y'
          and fr.fin_financial_account_id = fin_financ0_.fin_financial_account_id
      )

I checked in production (for our Weldom customer) and the result were the same for the 2 queries, the first one was taking more than 4 minutes and the second one less than one second.

I'm not sure at 100% that the 2 queries are identical, I'll let you review if it can be an accepted solution.
No tags attached.
Issue History
2024-09-10 16:01william_vermerschNew Issue
2024-09-10 16:01william_vermerschAssigned To => Triage Omni OMS
2024-09-10 16:01william_vermerschModules => Core
2024-09-10 16:01william_vermerschTriggers an Emergency Pack => No
2024-10-01 15:35jonaeNote Added: 0169851
2024-10-01 15:36jonaeAssigned ToTriage Omni OMS => kousalya_r
2024-10-03 12:08hgbotNote Added: 0169948
2024-10-04 13:16hgbotResolutionopen => fixed
2024-10-04 13:16hgbotStatusnew => closed
2024-10-04 13:16hgbotFixed in Version => PR25Q1
2024-10-04 13:16hgbotNote Added: 0170004
2024-10-04 13:16hgbotNote Added: 0170005
2024-10-04 14:56hgbotNote Added: 0170015
2024-10-04 16:19hgbotNote Added: 0170017
2024-10-04 16:19hgbotNote Added: 0170018

Notes
(0169851)
jonae   
2024-10-01 15:35   
Jira - https://openbravo.atlassian.net/browse/RM-17842 [^]
(0169948)
hgbot   
2024-10-03 12:08   
Merge Request created: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/1373 [^]
(0170004)
hgbot   
2024-10-04 13:16   
Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/openbravo/product/openbravo [^]
Changeset: 5166fd4babc75fcbd3aa4ee012090de5a369d5b6
Author: Kousalya Ramasamy <k.ramasamy@external.orisha.com>
Date: 04-10-2024 11:16:37
URL: https://gitlab.com/openbravo/product/openbravo/-/commit/5166fd4babc75fcbd3aa4ee012090de5a369d5b6 [^]

Fixed ISSUE-56426: Sql logic change for low reconciliation balance column

---
M src-db/database/sourcedata/AD_COLUMN.xml
---
(0170005)
hgbot   
2024-10-04 13:16   
Merge request merged: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/1373 [^]
(0170015)
hgbot   
2024-10-04 14:56   
Merge Request created: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/1377 [^]
(0170017)
hgbot   
2024-10-04 16:19   
Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/openbravo/product/openbravo [^]
Changeset: 308919d55913d50d6a1731b80c30854130c938db
Author: Kousalya Ramasamy <k.ramasamy@external.orisha.com>
Date: 04-10-2024 14:19:50
URL: https://gitlab.com/openbravo/product/openbravo/-/commit/308919d55913d50d6a1731b80c30854130c938db [^]

Fixed ISSUE-56426: Fixing issue in the CI execution

---
M src-db/database/sourcedata/AD_COLUMN.xml
---
(0170018)
hgbot   
2024-10-04 16:19   
Merge request merged: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/1377 [^]