Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0031649Openbravo ERP09. Financial managementpublic2015-12-04 15:052015-12-24 18:39
VictorVillar 
vmromanos 
urgentmajoralways
closedfixed 
5
pi 
3.0PR16Q1 
aferraz
Core
No
0031649: Balance Sheet and PL structure window has performance problems when you try to open the window
Balance Sheet and PL structure window has performance problems when you try to open the window
Balance Sheet and PL structure window has performance problems when you try to open the window. It takes around 1 minute to be opened
No tags attached.
causes defect 00318103.0PR16Q1 closed vmromanos Balance Sheet and PL structure does not show the Year and Reference Year 
Issue History
2015-12-04 15:05VictorVillarNew Issue
2015-12-04 15:05VictorVillarAssigned To => Triage Finance
2015-12-04 15:05VictorVillarModules => Core
2015-12-04 15:05VictorVillarTriggers an Emergency Pack => No
2015-12-04 15:05VictorVillarIssue Monitored: networkb
2015-12-18 12:44vmromanosAssigned ToTriage Finance => vmromanos
2015-12-18 12:44vmromanosStatusnew => acknowledged
2015-12-18 12:44vmromanosTypedesign defect => defect
2015-12-23 13:00VictorVillarResolution time => 1452466800
2015-12-23 13:08vmromanosStatusacknowledged => scheduled
2015-12-23 13:50vmromanosNote Added: 0082964
2015-12-23 13:57vmromanosReview Assigned To => aferraz
2015-12-24 11:27hgbotCheckin
2015-12-24 11:27hgbotNote Added: 0082979
2015-12-24 11:27hgbotStatusscheduled => resolved
2015-12-24 11:27hgbotResolutionopen => fixed
2015-12-24 11:27hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/0827ac596ad2fe52d55b100b6951645a50149eeb [^]
2015-12-24 11:29aferrazNote Added: 0082983
2015-12-24 11:29aferrazStatusresolved => closed
2015-12-24 11:29aferrazFixed in Version => 3.0PR16Q1
2015-12-24 18:39hudsonbotCheckin
2015-12-24 18:39hudsonbotNote Added: 0083000
2015-12-31 11:40VictorVillarRelationship addedrelated to 0031810
2015-12-31 12:21vmromanosRelationship deletedrelated to 0031810
2015-12-31 12:21vmromanosRelationship addedcauses 0031810

Notes
(0082964)
vmromanos   
2015-12-23 13:50   
Test plan 1:

As Openbravo Admin, open the Balance Sheet and PL structure window.
Verify the time spent to open it is in average with other windows in the same instance.


Test plan 2:
Run these two queries and verify no rows are returned:

SELECT O.AD_ORG_ID AS PADRE, Y.C_YEAR_ID AS ID, Y.YEAR || ' (' || C.NAME || ')' AS NAME
        FROM C_YEAR Y, C_CALENDAR C, AD_ORG O
        WHERE C.C_CALENDAR_ID = Y.C_CALENDAR_ID
        and c.ad_client_id = '23C59575B9CF467C9620760EB255B389'
          AND EXISTS (
                        SELECT 1 FROM AD_ORG ORG
                        WHERE AD_ORG_ISINNATURALTREE(O.AD_ORG_ID, ORG.AD_ORG_ID, '23C59575B9CF467C9620760EB255B389') = 'Y'
                        AND C.C_CALENDAR_ID = ORG.C_CALENDAR_ID
                      )
EXCEPT
SELECT O.AD_ORG_ID AS PADRE, Y.C_YEAR_ID AS ID, Y.YEAR || ' (' || C.NAME || ')' AS NAME
        FROM C_YEAR Y, C_CALENDAR C, AD_ORG O
        WHERE C.C_CALENDAR_ID = Y.C_CALENDAR_ID
          AND C.C_CALENDAR_ID IN (
                                    SELECT ORG.C_CALENDAR_ID FROM AD_ORG ORG
                                    WHERE AD_ISORGINCLUDED(O.AD_ORG_ID, ORG.AD_ORG_ID, '23C59575B9CF467C9620760EB255B389') <> -1
                                      AND ORG.C_CALENDAR_ID IS NOT NULL
                                  UNION
                                    SELECT ORG.C_CALENDAR_ID FROM AD_ORG ORG
                                    WHERE AD_ISORGINCLUDED(ORG.AD_ORG_ID,O.AD_ORG_ID, '23C59575B9CF467C9620760EB255B389') <> -1
                                      AND ORG.C_CALENDAR_ID IS NOT NULL
                                 );




SELECT O.AD_ORG_ID AS PADRE, Y.C_YEAR_ID AS ID, Y.YEAR || ' (' || C.NAME || ')' AS NAME
        FROM C_YEAR Y, C_CALENDAR C, AD_ORG O
        WHERE C.C_CALENDAR_ID = Y.C_CALENDAR_ID
          AND C.C_CALENDAR_ID IN (
                                    SELECT ORG.C_CALENDAR_ID FROM AD_ORG ORG
                                    WHERE AD_ISORGINCLUDED(O.AD_ORG_ID, ORG.AD_ORG_ID, '23C59575B9CF467C9620760EB255B389') <> -1
                                      AND ORG.C_CALENDAR_ID IS NOT NULL
                                  UNION
                                    SELECT ORG.C_CALENDAR_ID FROM AD_ORG ORG
                                    WHERE AD_ISORGINCLUDED(ORG.AD_ORG_ID,O.AD_ORG_ID, '23C59575B9CF467C9620760EB255B389') <> -1
                                      AND ORG.C_CALENDAR_ID IS NOT NULL
                                 )
EXCEPT
SELECT O.AD_ORG_ID AS PADRE, Y.C_YEAR_ID AS ID, Y.YEAR || ' (' || C.NAME || ')' AS NAME
        FROM C_YEAR Y, C_CALENDAR C, AD_ORG O
        WHERE C.C_CALENDAR_ID = Y.C_CALENDAR_ID
        and c.ad_client_id = '23C59575B9CF467C9620760EB255B389'
          AND EXISTS (
                        SELECT 1 FROM AD_ORG ORG
                        WHERE AD_ORG_ISINNATURALTREE(O.AD_ORG_ID, ORG.AD_ORG_ID, '23C59575B9CF467C9620760EB255B389') = 'Y'
                        AND C.C_CALENDAR_ID = ORG.C_CALENDAR_ID
                      );
(0082979)
hgbot   
2015-12-24 11:27   
Repository: erp/devel/pi
Changeset: 0827ac596ad2fe52d55b100b6951645a50149eeb
Author: Víctor Martínez Romanos <victor.martinez <at> openbravo.com>
Date: Wed Dec 23 13:42:24 2015 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/0827ac596ad2fe52d55b100b6951645a50149eeb [^]

Fixed bug 31649: Performance problems opening Balance Sheet and PL structure

selectYearsDouble query was consuming most of the time required for launching the window.

Rewritten query to use EXISTS clause, to filter by AD_CLIENT_ID and to call AD_ORG_ISINNATURALTREE() function, which reduces the query cost from 126320.46 to 2527.97, and the time from 20 secs to 0,8 secs

---
M src/org/openbravo/erpCommon/ad_reports/GeneralAccountingReports_data.xsql
---
(0082983)
aferraz   
2015-12-24 11:29   
Code review OK
(0083000)
hudsonbot   
2015-12-24 18:39   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/13c94f3d6e25 [^]
Maturity status: Test