Tech moves fast! Stay ahead of the curve with Techopedia!
Join nearly 200,000 subscribers who receive actionable tech insights from Techopedia.
In a general sense, a commit is the updating of a record in a database. In the context of a database transaction, a commit refers to the saving of data permanently after a set of tentative changes. A commit ends a transaction within a relational database and allows all other users to see the changes.
When a database system confirms that data has been saved, this must be an iron-clad guarantee. If not, there is a risk of data-integrity problems, in which there is uncertainty as to whether the available data is actually correct.
While this sounds simple, the reality is that database systems must offer also a degree of fault-tolerance. This means that the data must still be saved even in case of loss of some key components, i.e. disk failure. A good database system must also recover in case of sudden power loss and still roll-back or undo all uncommitted user changes or transactions. This is usually achieved by means of logging all transactions to a special file that will then be used in case data recovery is required.
Commits also serve another important function -- they serve as the determining points at which changed data is visible to other users. Say, a client’s address is being edited in a database system. Until the transaction is saved, other users who query the same client’s data should only see the address that was there before it was edited. Once committed, the new address permanently replaces the old one on disk, and any users now querying the data now view the changed address.