Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0022559Openbravo ERPA. Platformpublic2012-12-13 11:072016-07-05 17:28
shuehner 
shuehner 
normalminorhave not tried
closedfixed 
5
 
3.0PR16Q3 
alostale
Core
No
0022559: SqlC does execute all queries at compile time, which is not required.
SqlC does execute all select queries at compile time when it is processing xsql files.
Technically that is needed to get the number, names & data-types of the columns in the result as that info is used to generate the fields and data-reading code in the to be generated java file.

However the jdbc spec does have a optional method to get that same information for a query without executing it.

Postgresql does implement that optional method.
Oracle jdbc driver does implement that method only starting with Oracle 11R2
Quoting: https://docs.oracle.com/cd/E18283_01/java.112/e16548/whatsnew.htm#CJACGJHA [^]

""
Starting from Oracle Database 11g Release 2 (11.2), JDBC drivers support obtaining the metadata of a SELECT statement without executing the PreparedStatement. This feature works even with the earlier database releases. For more information, please refer to "Interface oracle.jdbc.OraclePreparedStatement".
""

So it should be fine to just have the updated jdbc driver even when the database behind is not yet 11R2 (Important as System Requirements only have 11 as min version, we do not require R2)


A prototype patch exist which does use this improvement transparently on postgresl and will remove all execution times for those queries on that db.

-
Review & apply proposed patch to get this compile time improvement on the database where it is possible.
Performance
related to design defect 0022553 new AugustoMauch sqlc.queryExecutionStrategy=optimized not applied in modules 
depends on backport 00334343.0PR16Q2.1 closed shuehner SqlC does execute all queries at compile time, which is not required. 
has duplicate defect 0020173 closed gorka_gil Build in 64bit environment generates "Error occurred during initalizaiton of VM" and "Too small inital heap" at sqlc 
diff 0011-pending22559.diff (894) 2016-06-05 16:11
https://issues.openbravo.com/file_download.php?file_id=9489&type=bug
Issue History
2012-12-13 11:07shuehnerNew Issue
2012-12-13 11:07shuehnerAssigned To => AugustoMauch
2012-12-13 11:07shuehnerModules => Core
2012-12-13 11:07shuehnerTriggers an Emergency Pack => No
2012-12-13 11:07shuehnerRelationship addedrelated to 0022553
2012-12-13 11:09shuehnerRelationship addedrelated to 0020173
2016-06-05 16:07shuehnerAssigned ToAugustoMauch => platform
2016-06-05 16:10shuehnerSummarySqlC does execute all queries at compile time, that can be avoid on pgsql (but not on oracle) => SqlC does execute all queries at compile time, which is not required.
2016-06-05 16:10shuehnerDescription Updatedbug_revision_view_page.php?rev_id=12316#r12316
2016-06-05 16:10shuehnerTag Attached: Performance
2016-06-05 16:11shuehnerFile Added: 0011-pending22559.diff
2016-06-05 16:21shuehnerNote Added: 0087004
2016-06-16 10:04hgbotCheckin
2016-06-16 10:04hgbotNote Added: 0087328
2016-06-16 10:04hgbotStatusnew => resolved
2016-06-16 10:04hgbotResolutionopen => fixed
2016-06-16 10:04hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/21698df6e4fe6e0272f997ba99be1c38bc966ee7 [^]
2016-06-16 10:05alostaleAssigned Toplatform => shuehner
2016-06-16 10:30alostaleReview Assigned To => alostale
2016-06-16 10:30alostaleNote Added: 0087332
2016-06-16 10:30alostaleStatusresolved => closed
2016-06-16 10:30alostaleFixed in Version => 3.0PR16Q3
2016-06-17 19:38hudsonbotCheckin
2016-06-17 19:38hudsonbotNote Added: 0087625
2016-07-05 17:28OrekariaStatusclosed => new
2016-07-05 17:28OrekariaResolutionfixed => open
2016-07-05 17:28OrekariaFixed in Version3.0PR16Q3 =>
2016-07-05 17:28OrekariaStatusnew => scheduled
2016-07-05 17:28OrekariaStatusscheduled => resolved
2016-07-05 17:28OrekariaResolutionopen => fixed
2016-07-05 17:28OrekariaStatusresolved => closed
2016-07-05 17:28OrekariaFixed in Version => 3.0PR16Q3
2016-07-26 12:36shuehnerRelationship replacedhas duplicate 0020173

Notes
(0087004)
shuehner   
2016-06-05 16:21   
Testing in bigger database:
a.) compile.complete.deploy now possible to run without needing to increase build.maxmemory -> before failed
a.) Compile.complete.deploy goes 1min faster by avoiding to run slow queries
(0087328)
hgbot   
2016-06-16 10:04   
Repository: erp/devel/pi
Changeset: 21698df6e4fe6e0272f997ba99be1c38bc966ee7
Author: Stefan Hühner <stefan.huehner <at> openbravo.com>
Date: Thu Jun 16 10:04:13 2016 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/21698df6e4fe6e0272f997ba99be1c38bc966ee7 [^]

fixed issue 22559: SqlC does execute all queries at compile time

  SqlC does execute all select queries at compile time when it is processing
  xsql files.

  Technically that is needed to get the number, names & data-types of the columns
  in the result as that info is used to generate the fields and data-reading code
  in the to be generated java file.

  However the jdbc spec does have a optional method to get that same information
  for a query without executing it.

  As this method is supported in current jdbc drivers for both Oracle and PostgreSQL,
  now it is used instead of executing the whole queries.

---
M src-core/src/org/openbravo/data/Sqlc.java
---
(0087332)
alostale   
2016-06-16 10:30   
code reviewd + tested both in Oracle and PG
(0087625)
hudsonbot   
2016-06-17 19:38   
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/0dc7be081b1c [^]
Maturity status: Test