Please enable JavaScript.
Coggle requires JavaScript to display documents.
DB Transactions by CSE junior & Bachelor students - Coggle Diagram
DB Transactions by CSE junior & Bachelor students
ACID Properties :
Consistency
if the database was is a consistent state before the operation
started, it will be in a consistent state after
Isolation
ex:the effects of an ongoing
transaction must not be visible to other transactions
Durability
all changes are registered
Atomicity
either all operations are reflected in the database
all or nothing
States of Transactions
Active
Partially Committed
Commited
Failed
Aborted
What is a DB transaction?
Definition
It is a bundle multiple DB changes into atomic operations.
Examples of atomic operations: Create, Insert, Delete
Constraints
-Datatype mismatch / Constraints violated/ Syntax Error
SQL command
Begin
Commit
Rollback
There are two main transaction issues
recovery after hardware failures and system crashes
concurrent execution of multiple transactions
Examples
Scheduler
*Provides a specific strategy for the execution of transactions and the corresponding concurrency control
*Avoids or resolves conflicts during concurrent data access
Transaction Manager
*Ensures that we proceed from one consistent state to another consistent state
*Ensures that transactions will not violate integrity constraints
Recovery Manager
*Restore the database to the state it was in before a failure
occurred
Example of the bank transfer
When the transfer fails
We use Undo operation
Scripting
A Transaction Script primarily divides the tasks into single procedures, making calls directly to the database or through a thin database wrapper. Each transaction will have its own Transaction Script.
Perfect for small applications that don't require a big data architecture.
Examples of use
calculate bonuses for costumers
load orders to deliver