database - Transactions for read-only DB access? -
There is a lot of different opinion about using a transaction to read from the database.
Developer Works Article:
If you are reading data only, why would you need a transaction? The answer is that you do not do this. To work only for reading work, the transaction adds to the overhead of the processing thread and can share the shared lock on the database (what kind of database are you using and how the set of isolation levels On the basis of)
In Hibernation as an Opinion Opinion, the following quote from the documentation is
We recommend that you do not use autocommit mode in any application, and Apply only read-only transactions only when there is a clear execution benefit or changes in future codes are not likely to be very low.
There is a similar debate on the EclipseLink mailing list.
P> Where is the truth? Are the best practices to read or not? If both are viable solutions, then what are the criteria to use the transaction?As far as I can see the level of separation is 'Read committed' is this right?
What are the experiences and recommendations?
Steven Davis
-
The standard SQL requires that if there is currently no lane If the bin is not in progress then a query should also start a new transaction. There are DBMSs, where it is not - which are an autocomit mode, for example (the statement starts a transaction and it completes the statement). By default, other DBMS statements make the atom (effective independence), but the next comma or rollback (IBM Infomercial Dynamic Server is the same - when the database is not MODE, the automatic "auto-canceling" such as '' Bug work '' Such as start an explicit transaction with a statement ANSI).
I do not know about the rollback advice ever. This does not make any difference to read-only transactions, and it is better to avoid the extent of disturbing your DBA, then to avoid rollback, but if your program proceeds without committing, DBMS will be incomplete Rollback should be done on the transaction - of course if it modifies the database, and (for simplicity) even though you have only selected data.
You want to change the default behavior of a series of operations, use transactions, even if the transaction is read only. If you are satisfied with the default behavior, it is important to use the transaction If your code is to be portable between DBMS, it is best to believe that you will need a transaction.
Comments
Post a Comment