Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0025361Openbravo ERPA. Platformpublic2013-12-18 08:362013-12-22 05:46
alostale 
alostale 
normaltrivialalways
closedfixed 
5
 
3.0MP31 
shankarb
Core
No
0025361: Unneeded queries when filtering
Whenever a filter on a foreign key is applied in a grid AD is queried to determine whether the identifier is composed by one or more columns.

This results in DB 3 queries (one to get column, one to get table and another one to get all columns in table) and in a loop over all columns in table.

Note these queries are repeated for each FK field that is used in the filter.
-Enable HQL SQL loggging
-Go to (for example) Product window
-Filter by organization
  Check log, these queries are present:

  select ... from AD_Table ...
  select ... from AD_Column ...
  select ... from AD_Column ...
Use in memory model instead of querying DB
Performance
related to defect 0020643 closed guilleaer fillters columns does not work when there are records with the character "-" 
related to defect 0036421 closed alostale Financial Account records are not filtered by name if the filter contains "-" 
Issue History
2013-12-18 08:36alostaleNew Issue
2013-12-18 08:36alostaleAssigned To => AugustoMauch
2013-12-18 08:36alostaleModules => Core
2013-12-18 08:36alostaleTriggers an Emergency Pack => No
2013-12-18 08:36alostaleAssigned ToAugustoMauch => alostale
2013-12-18 08:36alostaleTag Attached: Performance
2013-12-18 08:37alostaleDescription Updatedbug_revision_view_page.php?rev_id=5261#r5261
2013-12-18 08:38alostaleRelationship addedrelated to 0020643
2013-12-18 08:41hgbotCheckin
2013-12-18 08:41hgbotNote Added: 0062756
2013-12-18 08:41hgbotStatusnew => resolved
2013-12-18 08:41hgbotResolutionopen => fixed
2013-12-18 08:41hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/936ce44b74bd99462d5ffd2f7e35b376393e86de [^]
2013-12-18 08:43alostaleNote Added: 0062757
2013-12-19 12:32hudsonbotCheckin
2013-12-19 12:32hudsonbotNote Added: 0062862
2013-12-20 07:42alostaleReview Assigned To => shankarb
2013-12-22 05:46shankarbNote Added: 0063043
2013-12-22 05:46shankarbStatusresolved => closed
2013-12-22 05:46shankarbFixed in Version => 3.0MP31
2017-07-05 18:02caristuRelationship addedrelated to 0036421

Notes
(0062756)
hgbot   
2013-12-18 08:41   
Repository: erp/devel/pi
Changeset: 936ce44b74bd99462d5ffd2f7e35b376393e86de
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Wed Dec 18 08:41:31 2013 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/936ce44b74bd99462d5ffd2f7e35b376393e86de [^]

fixed bug 25361: unneeded queries when filtering

  using in memory model instead of reading identifier info from AD

---
M modules/org.openbravo.service.json/src/org/openbravo/service/json/AdvancedQueryBuilder.java
---
(0062757)
alostale   
2013-12-18 08:43   
Performance improvement after the fix:

* For each FK field that participates in the filter:
  - Prevent 3 DB queries
  - Prevent loop on columns
    - Total time: 10-15ms for each field
(0062862)
hudsonbot   
2013-12-19 12:32   
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/b878bb51dc09 [^]

Maturity status: Test
(0063043)
shankarb   
2013-12-22 05:46   
Code reviewed and tested in pi changeset a0194e74f446