Showing posts with label recoverable schedules. Show all posts
Showing posts with label recoverable schedules. Show all posts

Wednesday, December 8, 2021

DBMS MCQ - What is dirty read in DBMS transactions

Multiple choices questions in DBMS, What is dirty read in database? What will go wrong if a transaction is allowed to read a data item that was written by an uncommitted transaction? Why dirty read is not a preferable one? Can we permit a transaction that has used a data item written by another uncommitted transaction to commit? What are the problems with dirty read?

DBMS MCQ - Dirty read by transactions

< Previous                      

Next >

 

1. If a transaction is allowed to read a data item that was produced by an uncommitted transaction, what do we call this read? 

a) Repeatable read

b) Phantom read

c) Dirty read

d) Conflict read

Answer: (c) Dirty read

Reading the value of a data item that was produced by an uncommitted transaction is referred as dirty read problem. This will be avoided if we permit transactions to read the values that are produced by committed transactions.

Possible problems with dirty read in database

  • It may result in non-recoverable schedule. This is possible if a transaction T1 consumes the data written by T2 but commits before T2, and T2 decided to rollback.
  • It may lead to cascading rollback. This situation is possible if a transaction T3 consumes the data written by T2 which in turn read the data from another transaction T1, and T1 decided to rollback.
  • A dirt read can cause duplicate rows to be returned where none exist. alternatively, a dirty read can cause no rows to be returned when one (or more) exists. In some cases, dirty reads can return data that was never in the database at all (eg. rolled back before commit).

How you may avoid dirty read?

You can set the TRANSACTION ISOLATION LEVEL as READ COMMITTED. This specifies that the statements cannot read data that has been modified but not committed by other transaction. This prevents dirty reads.


< Previous                      

Next >


************************
Related posts:


What is non-recoverable schedule?

How dirty read may lead to non-recoverable schedules?

How to avoid deadlock in database environment?

List down the possible problems with dirty read

Concurrency control in DBMS

What would go wrong if a transaction is allowed to go for dirty read?

Saturday, December 4, 2021

DBMS MCQ - Which is a non-recoverable schedule

Multiple choices questions in DBMS, Which is non-recoverable schedule? How do we find whether a schedule is recoverable or not? Can we permit a transaction that has used a data item written by another uncommitted transaction?

DBMS MCQ - Non-recoverable schedules

< Previous                      

Next >

 

1. In a schedule S with two transactions T1 and T2, T1 reads the data item which was produced by T2 and T1 commits before T2 commits. In this case, the schedule S is said to be a _________ schedule.

a) recoverable

b) non-recoverable

c) conflict serializable

d) serial

Answer: (b) non-recoverable

The given case is a non-recoverable schedule. Let us suppose that the transaction T2 decided to rollback after T1 commits. In this case, the value of the data item consumed by T1 was wrong. We have to rollback T1 which cannot be done because T1 has committed. As per the durability property, the rollback is not permitted for a committed transaction.

How to avoid non-recoverable schedules?

To avoid such a situation, we can postpone the commit of T1 until T2 commits.

Recoverable schedule.

Let us consider a schedule with two transactions T1 and T2. In this schedule, if the transaction T2 reads the value of data item x which was produced by T1, then the commit of T1 must happen before that of T2. Such a schedule is recoverable schedule.


 

< Previous                      

Next >


************************
Related posts:


What is non-recoverable schedule?

How do we find whether a schedule is recoverable or not?

Can we permit a transaction that has read the data item which was written by an uncommitted transaction?

Why a committed transaction cannot be rolled back?

Concurrency control in DBMS

Featured Content

Multiple choice questions in Natural Language Processing Home

MCQ in Natural Language Processing, Quiz questions with answers in NLP, Top interview questions in NLP with answers Multiple Choice Que...

All time most popular contents