DBMS Transactions Flashcards
Whats a Transaction?
● A transaction is a sequence of operations performed as a single logical unit of work.
● A transaction is a logical unit of work that contains one or more SQL statements.
What are the ACID properties of transaction!?
● Atomicity
● Consistency
● Isolation
● Durability
Explain Atomicity?
● This property states that a transaction must be treated as an
atomic unit, that is, either all of its operations are executed or
none.
● Either transaction execute 0% or 100%.
Explain Consistency?
● The database must remain in a consistent state after any
transaction.
● If the database was in a consistent state before the execution of
a transaction, it must remain consistent after the execution of the
transaction as well.
● In our example, total of A and B must remain same before and
after the execution of transaction.
Explain Isolation?
● Changes occurring in a particular transaction will not be visible
to any other transaction until it has been committed.
● Intermediate transaction results must be hidden from other
concurrently executed transactions.
Explain Durability?
● After a transaction completes successfully, the changes it has
made to the database persist (permanent), even if there are
system failures.
● Once our transaction completed up to last step (step 6) its result
must be stored permanently. It should not be removed if system
fails.
Whats Active state in Transaction Diagram?
● This is the initial state.
● The transaction stays in this state while it is executing.
What’s Active state in Transaction Diagram?
● This is the initial state.
● The transaction stays in this state while it is executing.
What’s Partial Committed state in Transaction Diagram?
When a transaction executes its final operation/ instruction, it is said to be in a partially committed state.
What’s Failed state in Transaction Diagram?
● Discover that normal execution can no longer proceed.
● Once a transaction cannot be completed, any changes that it made must be undone rolling it back.
What’s Committed state in Transaction Diagram?
● The transaction enters in this state after successful completion of the transaction (after committing
transaction).
● We cannot abort or rollback a committed transaction.
What’s Aborted state in Transaction Diagram?
The state after the transaction has been rolled back and the database has been restored to its state prior to
the start of the transaction.
What is schedule?
● A schedule is a process of grouping the transactions into one and executing them in a
predefined order.
● A schedule is the chronological (sequential) order in which instructions are executed in a
system.
● A schedule is required in a database because when some transactions execute in parallel, they
may affect the result of the transaction.
● Means if one transaction is updating the values which the other transaction is accessing, then
the order of these two transactions will change the result of another transaction.
● Hence a schedule is created to execute the transactions.
What’s a serial schedule?
● A serial schedule is a schedule in which no transaction starts until a running transaction has
ended.
● A serial schedule is a schedule in which one transaction is executed completely before
starting another transaction.
● Transactions are executed one after the other.
● This type of schedule is called a serial schedule, as transactions are executed in a serial manner.
What’s a non-serial schedule?
● Schedule that interleave the execution of different transactions.
● Means second transaction is started before the first one could end and execution can switch
between the transactions back and forth.
● It contains many possible orders in which the system can execute the individual operations of the transactions