Consider the following items when deciding when to end a transaction:
- You can only commit or roll back the current transaction, so keep dependent
statements within the same transaction.
- Various locks are held while you have an outstanding transaction. Ending
the transaction releases the locks, and allows access to the data by other
users. This is the case for all SQL statements, including SELECT statements.
- As soon as a transaction has successfully been committed
or rolled back, it is fully recoverable from the system logs (this depends
on the Database Management System (DBMS)). Open transactions are not recoverable.