Transactions Flashcards
What does the A stand for in ACID?
Atomicity: Either all of the transaction should occur or none of it
What does the C stand for in ACID?
Consistency: The transaction should not leave the database in an inconsistent state
What does the I stand for in ACID?
Isolation: Transactions shouldn’t be aware of other transactions
What does the D stand for in ACID?
Durability: All changes made to the database should be persisted to storage.
What are the 5 transaction states?
- Active
- Partially committed
- Committed
- Failed
- Aborted
When is the transaction in the Active state
The initial state and the state the transaction stays in while executing.
When is the transaction in the partially committed state?
After the final statement in the application logic has been executed.
When is the transaction in the committed state?
After successful completion of the transaction.
When is the transaction in the failed state?
After the discovery normal executing can no longer proceed.
When is the transaction in the aborted state?
After the roll back occurs and the database is back in its state prior to the start of the transaction. Two options after abort:
Restart transaction
Kill the transaction
What is a schedule?
Order in which instructions of transactions are executed. Must consist of all instructions for scheduled transactions and preserve their order.
What is a serial schedule?
Transactions are run serially to completion - ensure consistency.
What are non-serial schedules?
Used for concurrent execution, doesn’t always give consistent results.
Why do we need equivalent schedules?
Need to have non-serial schedules function like a serial scheduler in order to have consistent database.
When are two schedules conflict equivalent?
IF:
- One can be transformed into the other by a series of swaps of non-conflicting adjacent instructions.
- It is conflict equivalent to some serial schedule.