DBMS Transactions Flashcards

1
Q

Whats a Transaction?

A

● 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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are the ACID properties of transaction!?

A

● Atomicity
● Consistency
● Isolation
● Durability

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Explain Atomicity?

A

● 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%.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Explain Consistency?

A

● 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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Explain Isolation?

A

● 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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Explain Durability?

A

● 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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Whats Active state in Transaction Diagram?

A

● This is the initial state.
● The transaction stays in this state while it is executing.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What’s Active state in Transaction Diagram?

A

● This is the initial state.
● The transaction stays in this state while it is executing.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What’s Partial Committed state in Transaction Diagram?

A

When a transaction executes its final operation/ instruction, it is said to be in a partially committed state.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What’s Failed state in Transaction Diagram?

A

● 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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What’s Committed state in Transaction Diagram?

A

● The transaction enters in this state after successful completion of the transaction (after committing
transaction).
● We cannot abort or rollback a committed transaction.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What’s Aborted state in Transaction Diagram?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is schedule?

A

● 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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What’s a serial schedule?

A

● 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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What’s a non-serial schedule?

A

● 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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What’s a Equivalent schedule?

A

● If two schedules produce the same result after execution, they are said to be equivalent
schedule.
● They may yield the same result for some value and different results for another set of values.
● That’s why this equivalence is not generally considered significant.

16
Q

What’s Serializability?

A

● A schedule is serializable if it is equivalent to a serial schedule.
● In serial schedules, only one transaction is allowed to execute at a time i.e. no concurrency is
allowed.
● Whereas in serializable schedules, multiple transactions can execute simultaneously i.e.
concurrency is allowed.

17
Q

What are the types of serializability?

A

Types (forms) of serializability
● Conflict serializability
● View serializability

18
Q

Explain Conflict Serializability?

A

If a given schedule can be converted into a serial schedule by swapping its non-conflicting operations, then it is called as a conflict serializable schedule.

18
Q

Explain View Serializability?

A

● Let S1 and S2 be two schedules with the same set of transactions. S1 and S2 are view
equivalent if the following three conditions are satisfied, for each data item Q
a) Initial Read
b) Updated Read
c) Final Write
● If a schedule is view equivalent to its serial schedule then the given schedule is said to be
view serializable.