The idea of nesting transactions, i.e., having transactions inside transactions,
is not from the database world. It gives rise to the following definitions:
An inner transaction begins and ends within another transaction. An
outer transaction has an inner transaction. An innermost or
bottom-level transaction is an inner transaction that is not an outer transaction.
An (or the) outermost or top-level
transaction is an outer transaction that is not an inner transaction.
Note: A transaction that is neither an inner nor an outer transaction is the same as a
transaction without nesting.
I do not think nesting is such a great idea,
because it necessarily violates two of the fundamental properties of transactions,
namely atomicity and durability. If nesting of transactions is used then
atomicity and durability cannot be hold for both outer and inner transactions:
- If inner transactions are durable, then outer transactions cannot be
atomic, i.e., they cannot rollback the changes of the inner transactions,
because they are permanent (durable).
- If outer transactions are atomic, then inner transactions cannot be
durable, i.e., they cannot keep their changes at a rollback of the outer
transactions, because they are atomic.