What is a transaction?
A transaction is an application-defined unit of work performed against a database. A transaction starts, modifications are made against the database, then the transaction is committed or rolled back. Once the transaction is committed, the changes made by the transaction become visible to other users and applications.
Transactions have the following standard "ACID" properties on which users and applications have come to rely:
Atomic—A transaction exhibits all-or-nothing behavior. If it is committed, all of its changes apply to the database. If it is rolled back, none of its changes apply.
Consistent—A transaction leaves the database in a consistent state.
Isolation—A transaction can isolate its changes from other transactions until it commits them. Other users do not see the work internal to the transaction while it is in progress.
Durable—Once a transaction commits, its results are persistent.
To achieve these properties, database management systems use a variety of locking mechanisms to ensure that multiple concurrent transactions are shielded or isolated from each other.