Database Transaction Processing

PamperedTiger avatar
PamperedTiger
·
·
Download

Start Quiz

Study Flashcards

16 Questions

What happens if a machine crashes between subtracting money from a savings account and adding it to a checking account?

The money is lost

Why is it necessary to perform addition to checking first in a transaction?

To ensure the bank doesn't lose money

What is the state of a transaction when it starts its operation?

Active

What is a transaction in the context of database systems?

A set of changes that must be made together

What can cause a transaction to fail?

Several reasons including computer failure, transaction errors, and concurrency control enforcement

What happens when a transaction is rolled back?

The database is restored to its previous state

What is the state of a transaction when it is successfully completed?

Committed

What can cause a disk failure during a transaction?

A disk read/write head crash

A transaction processing must ensure that the database is in a consistent state after its execution. What property of a transaction ensures this?

Atomicity

What is the purpose of the read_item(X) operation?

Reads a database item into a program variable

What is the minimum number of database access operations in a transaction?

One

What happens to the database if a transaction is aborted?

The database remains consistent

What is the purpose of the write_item(X) operation?

Writes the value of a program variable into the database item

What is the benefit of atomicity in transaction processing?

Improved data consistency

What is an example of a transaction in a banking system?

Transferring money from a savings account to a checking account

What are the basic operations on a database?

Read and write

Study Notes

Transaction Processing

  • A transaction is a logical unit of work that includes one or more database access operations, such as retrieval, insertion, deletion, and modification.

Characteristics of a Transaction

  • A transaction must be either completed or aborted.
  • A transaction is a program unit whose execution may change the contents of a database.
  • To ensure the integrity of the database, a transaction must be atomic (also called serialisability).

Atomic Transaction

  • An atomic transaction is a transaction in which either all actions associated with the transaction are executed to completion or none are performed.

Basic Operations on Database

  • Read and write are the basic operations on a database.
  • read_item(X) reads a database item named X into a program variable.
  • write_item(X) writes the value of program variable X into the database item named X.

Example of a Transaction

  • A customer transfers Rs. 1000 from savings to a checking account using an ATM.
  • The transaction requires two steps: subtracting the money from the savings account balance and adding the money to the checking account balance.

Reasons for a Transaction to Fail

  • Computer failure: hardware, software, or network error occurs in the computer system during transaction execution.
  • Transaction or system error: an operation in the transaction may cause it to fail, such as integer overflow or division by 0.
  • Local errors or exception conditions: certain conditions may occur during transaction execution, such as insufficient account balance.
  • Concurrency control enforcement: a transaction may be aborted due to a deadlock.
  • Disk failure: disk blocks may lose their data due to a disk read/write head crash.
  • Physical problems and catastrophes: fire, theft, etc.

States of a Transaction

  • Active state: after the transaction starts its operation.
  • Partially committed: when the last state is reached.
  • Aborted: after the transaction has been rolled back and the database has been restored to its state prior to the start of the transaction.
  • Committed: after successful completion of the transaction.

This quiz covers the concept of transactions in database management systems, including characteristics and atomicity. Test your knowledge of database transactions and their properties.

Make Your Own Quizzes and Flashcards

Convert your notes into interactive study material.

Get started for free

More Quizzes Like This

Use Quizgecko on...
Browser
Browser