Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Transaction Processing Concepts, Concurrency and Recovery What is a dirty read?

ID: 3690519 • Letter: T

Question

Transaction Processing Concepts, Concurrency and Recovery

What is a dirty read? A non-repeatable read? A. When transaction A reads data and the data is invalid because B fails; when read locks are not acquired and when performing a select B. Dirty - when transaction reads data modified by another transaction, but not yet committed, non-repeatable - data twice read which another transaction changed between two reads C. A dirty read occurs when transaction reads data from row that's been modified by another, non-repeatable reads may occur lock-based concurrency control. D. Dirty read - one transaction updates the database and then the transaction fails. Non-repeatable read - transaction reads item twice but item is changed between reads.

Explanation / Answer

Dirty Read:-

Dirty read occurs when one transaction is changing the record, and the other transaction can read this record before the first transaction has been committed or rolled back. This is known as a dirty read scenario because there is always the possibility that the first transaction may rollback the change, resulting in the second transaction having read an invalid data.

Dirty Read Example:-

Transaction A begins.
UPDATE EMPLOYEE SET SALARY = 10000 WHERE EMP_ID= ‘123’;

Transaction B begins.
SELECT * FROM EMPLOYEE;
(Transaction B sees data which is updated by transaction A. But, those updates have not yet been committed.)

Non-Repeatable Read:-

Non Repeatable Reads happen when in a same transaction same query yields to a different result. This occurs when one transaction repeatedly retrieves the data, while a difference transactions alters the underlying data. This causes the different or non-repeatable results to be read by the first transaction.

Non-Repeatable Example:-

Transaction A begins.
SELECT * FROM EMPLOYEE WHERE EMP_ID= ‘123’;

Transaction B begins.
UPDATE EMPLOYEE SET SALARY = 20000 WHERE EMP_ID= ‘123’;
(Transaction B updates rows viewed by the transaction A before transaction A commits.) If Transaction A issues the same SELECT statement, the results will be different.

Therefore, (B) satisfies the definitions the most.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote