Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0025159Openbravo ERPA. Platformpublic2013-11-14 14:562013-12-18 11:44
jonalegriaesarte 
shankarb 
urgentmajorhave not tried
closedfixed 
5
 
3.0MP313.0MP31 
AugustoMauch
Core
No
0025159: Bad performance executing openView function
When executing openView function:
OB.Utilities.openView('184', '296', 'Goods Receipt', '95F18AE75A0C4717AFA7F28F3DF7587E');

The following extra query is executed (that is not the normal grid query, because is selecting only the m_inout_id):
select materialmg0_.M_InOut_ID as col_0_0_ from M_InOut materialmg0_ cross join C_DocType documentty1_ where
materialmg0_.C_DocType_ID=documentty1_.C_DocType_ID and (materialmg0_.MovementType in ('V-' , 'V+')) and materialmg0_.Islogistic='N' and
documentty1_.IsReturn='N' and (materialmg
0_.AD_Org_ID in ('E443A31992CB4635AFCAEABE7183CE85' , '0' , 'DC206C91AA6A4897B44DA897936E0EC3' ,
'7BABA5FF80494CAFA54DEBD22EC46F01' , 'BAE22373FEBE4CCCA24517E23F0C8A48' , '19404EA
D144C49A0AF37D54377CF452D' , 'B843C30461EA4501935CB1D125C9C25A' , '2E60544D37534C0B89E765FE29BC0B43')) and
(materialmg0_.AD_Client_ID in ('23C59575B9CF467C9620760EB255B389' , '0')
) order by materialmg0_.DocumentNo, materialmg0_.M_InOut_ID

This query does not have any limit. That's why it is causing bad performance.
When executing openView function:
OB.Utilities.openView('184', '296', 'Goods Receipt', '95F18AE75A0C4717AFA7F28F3DF7587E');

The following extra query is executed (that is not the normal grid query, because is selecting only the m_inout_id):
select materialmg0_.M_InOut_ID as col_0_0_ from M_InOut materialmg0_ cross join C_DocType documentty1_ where
materialmg0_.C_DocType_ID=documentty1_.C_DocType_ID and (materialmg0_.MovementType in ('V-' , 'V+')) and materialmg0_.Islogistic='N' and
documentty1_.IsReturn='N' and (materialmg
0_.AD_Org_ID in ('E443A31992CB4635AFCAEABE7183CE85' , '0' , 'DC206C91AA6A4897B44DA897936E0EC3' ,
'7BABA5FF80494CAFA54DEBD22EC46F01' , 'BAE22373FEBE4CCCA24517E23F0C8A48' , '19404EA
D144C49A0AF37D54377CF452D' , 'B843C30461EA4501935CB1D125C9C25A' , '2E60544D37534C0B89E765FE29BC0B43')) and
(materialmg0_.AD_Client_ID in ('23C59575B9CF467C9620760EB255B389' , '0')
) order by materialmg0_.DocumentNo, materialmg0_.M_InOut_ID

This query does not have any limit. That's why it is causing bad performance.
Performance
related to defect 00251613.0MP31 closed shankarb Alert Management window's link's bad performance 
diff Fix25161-25159-25136.diff (4,046) 2013-11-28 10:15
https://issues.openbravo.com/file_download.php?file_id=6533&type=bug
Issue History
2013-11-14 14:56jonalegriaesarteNew Issue
2013-11-14 14:56jonalegriaesarteAssigned To => AugustoMauch
2013-11-14 14:56jonalegriaesarteModules => Core
2013-11-14 14:56jonalegriaesarteTriggers an Emergency Pack => No
2013-11-14 14:56jonalegriaesarteTag Attached: Performance
2013-11-19 17:44alostaleAssigned ToAugustoMauch => shankarb
2013-11-21 16:19jonalegriaesarteTarget Version3.0MP31 => 3.0MP30
2013-11-22 07:25alostaleRelationship addedrelated to 0025161
2013-11-27 06:11shankarbFile Added: Fix25161-25159-25136.diff
2013-11-27 10:02shankarbNote Added: 0062396
2013-11-27 11:32alostaleNote Added: 0062402
2013-11-27 11:32alostaleTarget Version3.0MP30 => 3.0MP31
2013-11-28 10:15shankarbFile Deleted: Fix25161-25159-25136.diff
2013-11-28 10:15shankarbFile Added: Fix25161-25159-25136.diff
2013-12-05 08:10shankarbIssue Monitored: AugustoMauch
2013-12-05 08:11shankarbReview Assigned To => AugustoMauch
2013-12-05 08:12shankarbStatusnew => scheduled
2013-12-05 08:12shankarbfix_in_branch => pi
2013-12-05 08:13shankarbNote Added: 0062545
2013-12-05 08:13shankarbStatusscheduled => resolved
2013-12-05 08:13shankarbFixed in Version => pi
2013-12-05 08:13shankarbFixed in SCM revision => https://code.openbravo.com/erp/devel/pi/rev/0ca986e840a2 [^]
2013-12-05 08:13shankarbResolutionopen => fixed
2013-12-18 11:44AugustoMauchNote Added: 0062773
2013-12-18 11:44AugustoMauchStatusresolved => closed
2013-12-18 11:44AugustoMauchFixed in Versionpi => 3.0MP31

Notes
(0062396)
shankarb   
2013-11-27 10:02   
Modifications in OB.Utilities.openView

* If recordId is present and direct argument is not provided, it is set to true.
* If recordId is present and singleRecord argument is not present it is set to true.
* This is done to prevent fetching all the records and fetch the particular recordId alone.

Before the fix, even if the recordId was passed, if the direct argument is not provided, it will fetch all the records of the grid, but the record provided will be shown. After the fix, if the recordId is passed, and direct argument is not provided, we set it to true and only that particular record is filtered and fetched. Similarly if the singleRecord argument was not provided, it was not used. But now if the recordId is present, singleRecord is also set to true.

To revert back to the original scenario, the arguments 'direct','singleRecord' has to be set to false. This will again fetch all the records of the grid and select the record passed.
(0062402)
alostale   
2013-11-27 11:32   
Postponed to mp31 due to being in closing period for mp30
(0062545)
shankarb   
2013-12-05 08:13   
Repository: erp/devel/pi
Changeset: 0ca986e840a24c89b4b5de3af108ac74f90deabf
Author: Shankar Balachandran <shankar.balachandran <at> openbravo.com>
Date: Thu Nov 28 14:43:09 2013 +0530
URL: http://code.openbravo.com/erp/devel/pi/rev/0ca986e840a24c89b4b5de3af108ac74f90deabf [^] [^]

Fixes Issue 25161,25159,25136 : openDirectTab and openView optimization

Modifications in OB.Utilities.openDirectTab
* Added a new parameter direct that would enable only to fetch the particular record alone.
* By default it is set to true if recordId argument is present.
* If all data needs to be fetched, the argument should be passed as false.

---
M modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-utilities.js
---
(0062773)
AugustoMauch   
2013-12-18 11:44   
Code reviewed and verified in pi@469ba15fbba3