Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0020415Openbravo ERPY. DBSourceManagerpublic2012-05-04 10:392012-05-25 12:12
marvintm 
marvintm 
normalminorhave not tried
closedfixed 
5
 
3.0MP12 
Core
No
0020415: Make update.database faster by generating a batch of statements instead of executing one by one
One possible idea to make update.database faster consists in making a big batch of statements and execute them at the same time, instead of executing them one by one.

This idea should be used primarily on the parts which are currently slow enough to make this worthwhile. This parts right now are considered to be:

- The dropping and creation of foreign keys and triggers
- The dropping and creation of not null constraints.

As doing this for Oracle would require a refactor of the methods which drop and create foreign keys and triggers, for now this change will only be done on PostgreSQL.
Just execute update.database before the change and after it. Notice that the execution is faster with the change.
No tags attached.
Issue History
2012-05-04 10:39marvintmNew Issue
2012-05-04 10:39marvintmAssigned To => marvintm
2012-05-04 10:39marvintmModules => Core
2012-05-04 10:49hgbotCheckin
2012-05-04 10:49hgbotNote Added: 0048366
2012-05-04 10:49hgbotStatusnew => resolved
2012-05-04 10:49hgbotResolutionopen => fixed
2012-05-04 10:49hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/dbsm-main/rev/85b10db2ef3e03be997a008b8c34b7676dc9df2f [^]
2012-05-04 11:07hgbotCheckin
2012-05-04 11:07hgbotNote Added: 0048368
2012-05-04 11:07hgbotFixed in SCM revisionhttp://code.openbravo.com/erp/devel/dbsm-main/rev/85b10db2ef3e03be997a008b8c34b7676dc9df2f [^] => http://code.openbravo.com/erp/devel/pi/rev/6d9804bf7aef36b9aa29020501690d40ca255719 [^]
2012-05-04 13:32hgbotCheckin
2012-05-04 13:32hgbotNote Added: 0048378
2012-05-04 13:36hgbotCheckin
2012-05-04 13:36hgbotNote Added: 0048379
2012-05-04 14:00AugustoMauchNote Added: 0048381
2012-05-04 14:00AugustoMauchStatusresolved => closed
2012-05-04 14:00AugustoMauchFixed in Version => 3.0MP12
2012-05-14 20:29hgbotCheckin
2012-05-14 20:29hgbotNote Added: 0048636
2012-05-14 20:30hgbotCheckin
2012-05-14 20:30hgbotNote Added: 0048637
2012-05-16 11:51hgbotCheckin
2012-05-16 11:51hgbotNote Added: 0048688
2012-05-16 11:52hgbotCheckin
2012-05-16 11:52hgbotNote Added: 0048689
2012-05-16 12:45AugustoMauchNote Added: 0048693
2012-05-25 12:09hudsonbotCheckin
2012-05-25 12:09hudsonbotNote Added: 0049020
2012-05-25 12:09hudsonbotCheckin
2012-05-25 12:09hudsonbotNote Added: 0049025
2012-05-25 12:12hudsonbotCheckin
2012-05-25 12:12hudsonbotNote Added: 0049125
2012-05-25 12:12hudsonbotCheckin
2012-05-25 12:12hudsonbotNote Added: 0049143

Notes
(0048366)
hgbot   
2012-05-04 10:49   
Repository: erp/devel/dbsm-main
Changeset: 85b10db2ef3e03be997a008b8c34b7676dc9df2f
Author: Antonio Moreno <antonio.moreno <at> openbravo.com>
Date: Fri May 04 10:49:16 2012 +0200
URL: http://code.openbravo.com/erp/devel/dbsm-main/rev/85b10db2ef3e03be997a008b8c34b7676dc9df2f [^]

Fixed issue 20415. Added batching for some parts of update.database in PostgreSQL to improve performance.
- Added a method (evaluateBatchRealBatch) which works like evaluateBatch, but instead of executing the commands one by one, executes them in a batch. This method is not compatible with 'forced' commands.
- Changed some calls to evaluateBatch to the new method, in the PostgreSQL execution flow. This will improve the performance of those parts.

---
M src/org/apache/ddlutils/platform/PlatformImplBase.java
M src/org/apache/ddlutils/platform/postgresql/PostgreSqlPlatform.java
M src/org/openbravo/ddlutils/task/AlterDatabaseDataAll.java
---
(0048368)
hgbot   
2012-05-04 11:07   
Repository: erp/devel/pi
Changeset: 6d9804bf7aef36b9aa29020501690d40ca255719
Author: Antonio Moreno <antonio.moreno <at> openbravo.com>
Date: Fri May 04 11:06:22 2012 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/6d9804bf7aef36b9aa29020501690d40ca255719 [^]

Fixed issue 20415. Added batching for some parts of update.database in PostgreSQL to improve performance.
> - Added a method (evaluateBatchRealBatch) which works like evaluateBatch, but instead of executing the commands one by one, executes them in a batch. This method is not compatible with 'forced' commands.
> - Changed some calls to evaluateBatch to the new method, in the PostgreSQL execution flow. This will improve the performance of those parts.

---
M src-db/database/lib/dbsourcemanager.jar
---
(0048378)
hgbot   
2012-05-04 13:32   
Repository: erp/devel/dbsm-main
Changeset: 3fba02a91791643aa662fd1f84f76e0ba420fa7c
Author: Antonio Moreno <antonio.moreno <at> openbravo.com>
Date: Fri May 04 13:31:39 2012 +0200
URL: http://code.openbravo.com/erp/devel/dbsm-main/rev/3fba02a91791643aa662fd1f84f76e0ba420fa7c [^]

Related to issue 20415. The new method will not be used for any method in Oracle

---
M src/org/apache/ddlutils/platform/PlatformImplBase.java
---
(0048379)
hgbot   
2012-05-04 13:36   
Repository: erp/devel/pi
Changeset: d2161c228cc9dbe27a68991f599bf76883262713
Author: Antonio Moreno <antonio.moreno <at> openbravo.com>
Date: Fri May 04 13:35:56 2012 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/d2161c228cc9dbe27a68991f599bf76883262713 [^]

Related to issue 20415. The new method will not be used for any method in Oracle

---
M src-db/database/lib/dbsourcemanager.jar
---
(0048381)
AugustoMauch   
2012-05-04 14:00   
Code reviewed and verified in pi@d2161c228cc9
(0048636)
hgbot   
2012-05-14 20:29   
Repository: erp/devel/pi
Changeset: 498399deee0d63454b37ec1ee6e2d2a49ace4ee5
Author: Antonio Moreno <antonio.moreno <at> openbravo.com>
Date: Mon May 14 20:29:18 2012 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/498399deee0d63454b37ec1ee6e2d2a49ace4ee5 [^]

Related to issue 20415. The old evaluateBatch will now be used if there is an error.
> Also, update.database.script has been improved so that it includes some things which are now done by update.database

---
M src-db/database/lib/dbsourcemanager.jar
---
(0048637)
hgbot   
2012-05-14 20:30   
Repository: erp/devel/dbsm-main
Changeset: 1ba8239f5aff0ed27f4a8a2bd5dfb10da3102c22
Author: Antonio Moreno <antonio.moreno <at> openbravo.com>
Date: Mon May 14 20:21:14 2012 +0200
URL: http://code.openbravo.com/erp/devel/dbsm-main/rev/1ba8239f5aff0ed27f4a8a2bd5dfb10da3102c22 [^]

Related to issue 20415. The old evaluateBatch will now be used if there is an error.
Also, update.database.script has been improved so that it includes some things which are now done by update.database

---
M src/org/apache/ddlutils/Platform.java
M src/org/apache/ddlutils/platform/PlatformImplBase.java
M src/org/openbravo/ddlutils/task/AlterXML2SQL.java
---
(0048688)
hgbot   
2012-05-16 11:51   
Repository: erp/devel/dbsm-main
Changeset: 53990057f9337c73cb1c1705fa2957b556d901a4
Author: Antonio Moreno <antonio.moreno <at> openbravo.com>
Date: Wed May 16 11:51:26 2012 +0200
URL: http://code.openbravo.com/erp/devel/dbsm-main/rev/53990057f9337c73cb1c1705fa2957b556d901a4 [^]

Related to issue 20415. Moved the closeStatement to a safer place. Fixed wrong method in update.database.script

---
M src/org/apache/ddlutils/platform/PlatformImplBase.java
M src/org/openbravo/ddlutils/task/AlterXML2SQL.java
---
(0048689)
hgbot   
2012-05-16 11:52   
Repository: erp/devel/pi
Changeset: 7e1cede2db376153bbe01c3e43750fcf8991f1c2
Author: Antonio Moreno <antonio.moreno <at> openbravo.com>
Date: Wed May 16 11:52:03 2012 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/7e1cede2db376153bbe01c3e43750fcf8991f1c2 [^]

Related to issue 20415. Moved the closeStatement to a safer place. Fixed wrong method in update.database.script

---
M src-db/database/lib/dbsourcemanager.jar
---
(0048693)
AugustoMauch   
2012-05-16 12:45   
The code of the update has been reviewed and verified in pi@e260a84b287f.

The following has been tested in order to test that if there is an error the rest of the batch will be executed:
- Remove from the database a not null constraint of a field (i.e. the name property of c_uom)
- Modify a registry so it stores null in that field (i.e. update c_uom set name = null where name = 'Year'.
- Execute ant smartbuild -Dlocal=no -Dforce=yes. The first time the system will try to enable all the not null restrictions at once. It will not be able to enable the not null restriction of the name field of c_uom. In order to make sure that the rest of the Batch is executed, it will be executed one query at a time.
- Execute ant export.database. Only c_uom.xml should have changed, meaning that the rest of the not null restrictions have been enabled.
(0049020)
hudsonbot   
2012-05-25 12:09   
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/5401e185a8b0 [^]

Maturity status: Test
(0049025)
hudsonbot   
2012-05-25 12:09   
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/5401e185a8b0 [^]

Maturity status: Test
(0049125)
hudsonbot   
2012-05-25 12:12   
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/5401e185a8b0 [^]

Maturity status: Test
(0049143)
hudsonbot   
2012-05-25 12:12   
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/5401e185a8b0 [^]

Maturity status: Test