Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0028477Openbravo ERPA. Platformpublic2014-12-23 15:512015-11-27 10:33
alostale 
alostale 
highminorhave not tried
closedfixed 
5
 
3.0PR16Q1 
caristu
Core
No
0028477: view generation: unneeded queries to trl tables
When standard views are generated, translation tables (ad_field_trl...) are queried even there is no translation installed in the instance.

This is unnecessary because all those queries will return no record and can be known in advance.
-Set pg to log all queries
-In an instance with no translation installed
-Open BP window
-Check there are 200 queries to ad_field_trl, 120 to ad_ref_list_value_trl
org.openbravo.client.application.window.OBViewUtil.getLabel method should look for translations only in case there is at least one installed: OBContext.hasTranslationInstalled()
Performance
duplicate of design defect 0039670 closed alostale view generation scalability issues 
related to defect 0029910 closed platform exporting grid to csv can fail if audit fields are included 
related to defect 0028478 closed NaroaIriarte view generation: unneeded queries to grid config tables 
related to defect 0028479 closed alostale unneeded queries to ad_langue table 
related to defect 00253873.0MP31 closed alostale unneeded flushes in view generation 
Issue History
2014-12-23 15:51alostaleNew Issue
2014-12-23 15:51alostaleAssigned To => AugustoMauch
2014-12-23 15:51alostaleModules => Core
2014-12-23 15:51alostaleTriggers an Emergency Pack => No
2014-12-23 15:52alostaleSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=7331#r7331
2014-12-23 15:53alostaleTag Attached: Performance
2014-12-23 15:59alostaleRelationship addedrelated to 0028478
2014-12-23 16:10alostaleRelationship addedrelated to 0028479
2015-01-07 16:06shuehnerIssue Monitored: shuehner
2015-03-06 14:45alostalePrioritynormal => urgent
2015-03-06 14:45alostaleStatusnew => scheduled
2015-03-06 14:46alostaleStatusscheduled => acknowledged
2015-03-11 08:10alostaleTarget Version3.0PR15Q2 =>
2015-03-17 14:37alostaleAssigned ToAugustoMauch => platform
2015-11-11 11:37alostalePriorityurgent => normal
2015-11-11 12:42alostalePrioritynormal => high
2015-11-12 18:13alostaleRelationship addedrelated to 0029910
2015-11-13 08:30alostaleStatusacknowledged => scheduled
2015-11-13 08:30alostaleAssigned Toplatform => alostale
2015-11-13 08:35alostaleRelationship addedrelated to 0025387
2015-11-13 09:03hgbotCheckin
2015-11-13 09:03hgbotNote Added: 0081801
2015-11-13 09:03hgbotStatusscheduled => resolved
2015-11-13 09:03hgbotResolutionopen => fixed
2015-11-13 09:03hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/fdb8a4e6f1858aa6c1379d90e73887447d20d834 [^]
2015-11-13 09:04alostaleReview Assigned To => caristu
2015-11-13 09:17alostaleNote Added: 0081803
2015-11-13 09:18alostaleNote Edited: 0081803bug_revision_view_page.php?bugnote_id=0081803#r10194
2015-11-13 10:06hgbotCheckin
2015-11-13 10:06hgbotNote Added: 0081805
2015-11-23 21:17hudsonbotCheckin
2015-11-23 21:17hudsonbotNote Added: 0082223
2015-11-23 21:17hudsonbotCheckin
2015-11-23 21:17hudsonbotNote Added: 0082224
2015-11-27 10:33caristuNote Added: 0082402
2015-11-27 10:33caristuStatusresolved => closed
2015-11-27 10:33caristuFixed in Version => 3.0PR16Q1
2018-11-22 09:25alostaleRelationship addedduplicate of 0039670

Notes
(0081801)
hgbot   
2015-11-13 09:03   
Repository: erp/devel/pi
Changeset: fdb8a4e6f1858aa6c1379d90e73887447d20d834
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Fri Nov 13 09:02:58 2015 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/fdb8a4e6f1858aa6c1379d90e73887447d20d834 [^]

fixed bug 28477: view generation: unneeded queries to trl tables

  When generating view definition for standard windows queries to translation
  tables where performed regardless the instance had no translation installed.
  This results in several queries that were useless as they should never return
  any value.

  These queries have been prevented by checking if translations are installed
  before executing them.

---
M modules/org.openbravo.client.application/src/org/openbravo/client/application/ViewComponent.java
M modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewParameterHandler.java
M modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewTab.java
M modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewUtil.java
M modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/DataSourceProperty.java
M modules/org.openbravo.userinterface.selector/src/org/openbravo/userinterface/selector/SelectorComponent.java
---
(0081803)
alostale   
2015-11-13 09:17   
(edited on: 2015-11-13 09:18)
Tested:
* Compared generated json before and after the fix: both are identical in instances with and without translations installed.
* Translations still work as they did before.
* Having translations installed there is no performance regression after the fix

Improvements:
* All trl queries have been prevented if not translation is installed
* Reductions depend on the view being generated. For the tested windows, the average reduction is 11% in total number of queries and 25% faster
* More details on timing and number of queries can be found here [1]

[1] https://docs.google.com/spreadsheets/d/1OONLHyvxnq0-Y11uOSx1gEPyJzmgqOhDuogl1c08U9U/edit?usp=sharing [^]

(0081805)
hgbot   
2015-11-13 10:06   
Repository: erp/devel/pi
Changeset: 9191d32f8b30fc560d9bdc123eb9d24cd6c3d2af
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Fri Nov 13 10:05:37 2015 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/9191d32f8b30fc560d9bdc123eb9d24cd6c3d2af [^]

related to bug 28477: removed debugging code

---
M modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewUtil.java
---
(0082223)
hudsonbot   
2015-11-23 21:17   
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/7b56bebaaa88 [^]
Maturity status: Test
(0082224)
hudsonbot   
2015-11-23 21:17   
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/7b56bebaaa88 [^]
Maturity status: Test
(0082402)
caristu   
2015-11-27 10:33   
Code review + tested OK:

- Unneeded queries are not executed (with no translation installed)
- Translations continue working fine