We shall start from a very simplified data model (similar to key-value pair data model) where a database consists of
data items each located at a unique address. Data items do not have any internal structure and can access with read
and write operations. So, for a while we shall forget about relational tables, rows, attributes, values of attributes and SQL.
We shall access a database with the operations like a=read(x) where x is a unique address of a data item
(we shall call it later on as a data item x) and a is a transient memory (RAM) variable.
A value of data item x is stored in a after reading it from persistent memory.
A can be considered as an ordinary variable of an atomic type (int, float, double, ...) available in
any general purpose procedural programming language.
The second operation used to transfer values to a database is an operation write(x, a) that takes the value of a transient variable (RAM) a
and writes it as a value of persistent storage data item x.
Two remaining operations used are commit and rollback.
An operation abort is a database scheduler operation that stops and automatically rollbacks a transaction.
A transaction is defined in such a data model as "a partially ordered set of read, write operations on the database items" .
Why it is a partially ordered set and no linearly ordered set of database operations ? It is because at the very and
a transaction is an ordinary computer program and its processing depending on input data and an environment it is processed in.
So, depending on input data a computer program may process through one sequence of operations while for different input data
it may process through another sequence of operations. It is why a computer program is a partially ordered set of operations
(see a definition of "partial order" in math for computing subject). In our case we shall use only read, write, commit, rollback
and abort operations.
Users interact with a database by executing programs. it simply means that at the every end a transaction is a computer program,
for example JDBC (Java + SQL) program.
Execution (processing) of a program is equivalent to execution of a partially ordered set of read, write operations.
Well, if a transaction is a partially ordered set of operations than execution of a transaction must be equivalent to
processing the operations along one of the possible execution paths.
A database is visible to transactions as a collection of data items. we have already talked about that.
Just atomic data items, each one with a unique address and single atomic value.
Concurrently running transactions interleave their operations. It is because database systems are almost always installed
on top if time-sharing operation systems.
Transactions have no impact on execution of their operations. Execution is a sequence of operations and transaction has
no impact on processing of the operations.
Each transaction terminates by either commit or abort operation. We have already discussed the operations of database transactions.
Each transaction arrives at a consistent database state and must leave a database in a consistent state as well.
It means that correctly implemented transactions MUST NOT corrupt a database.