Subject | autocommit mode |
---|---|
Author | Juan Pedro López Sáez |
Post date | 2003-06-05T18:25:28Z |
Hello everybody,
I've got a perfomance issue related to the autocommit mode.
Most of my application's database accesses are single SQL statements, so I don't need a transaction management different to the autoCommit(true) behaviour.
However, there are a few cases where I must manage transactions in order to update two tables atomically, so there I set autoCommit(false).
Because of this mixed scenario, I set autoCommit(true) everytime a perform an "unmanaged" database access. It's a simple way of writting reusable code.
Questions:
1- Is it a high consuming resources to set autoCommit(true), just to ensure the database access in this mode?
2- I have read contradictory oppinions about switching autocommit on:
- It is recomended in order to release resources attached to an active transaction.
- It is not recomended because there is a perfomance penalty. Every database access is an independent transaction and transactions are time consuming operations.
What's the best choice?
3- If I switch autoCommit off, does a new transaction start inmediately either after executing that opertation or after performing a commit/rollback?
Any comments would be very apreciate.
Thank you.
Juan Pedro
I've got a perfomance issue related to the autocommit mode.
Most of my application's database accesses are single SQL statements, so I don't need a transaction management different to the autoCommit(true) behaviour.
However, there are a few cases where I must manage transactions in order to update two tables atomically, so there I set autoCommit(false).
Because of this mixed scenario, I set autoCommit(true) everytime a perform an "unmanaged" database access. It's a simple way of writting reusable code.
Questions:
1- Is it a high consuming resources to set autoCommit(true), just to ensure the database access in this mode?
2- I have read contradictory oppinions about switching autocommit on:
- It is recomended in order to release resources attached to an active transaction.
- It is not recomended because there is a perfomance penalty. Every database access is an independent transaction and transactions are time consuming operations.
What's the best choice?
3- If I switch autoCommit off, does a new transaction start inmediately either after executing that opertation or after performing a commit/rollback?
Any comments would be very apreciate.
Thank you.
Juan Pedro
-- Juan Pedro López Sáez ALTIRIA TIC, S.L.L. www.altiria.com Centro de Empresas "La Arboleda" Carretera NIII km. 7,300 - Campus Sur 28031 MADRID Teléfono/Fax 91 33 111 98 Móvil 610 258 837 jpls@... |