ScholarQuill logoScholarQuillUniversity Notes
My Semester
Explore Notes
Past Papers12 New
Video CoursesNew
Search
Settings
Study Tools
GPA/CGPA Calculator
Schedule & To-Do
Student Portal
Contact
Contact
ScholarQuill logo
My Semester
Explore Notes
Past Papers12 New
Video CoursesNew
Search
Settings
GPA/CGPA Calculator
Schedule & To-Do
Student Portal
Contact
ScholarQuill logoScholarQuillUniversity Notes
Study PortalCOMP3146Transactional Processiโ€ฆ
Ctrl + K
Login
Explore
Search
Semester
Papers
CGPA
    COMP3146

    Advance Database Management Systems

    Progress0 / 18 done
    Topics18
    1Introduction to advance data models such as object relational, object oriented2File organizations concepts3Transactional processing4Concurrency control techniques5Recovery techniques6Query processing and optimization7Database Programming (PL/SQL)8Database Programming (T-SQL)9Database Programming (similar technology)10Integrity and security11Database Administration (Role management)12Database Administration (managing database access)13Database Administration (views)14Physical database design and tuning15Distributed database systems16Emerging research trends in database systems17MONGO DB18NO SQL (or similar technologies)
    4 min read
    Topic 3 of 18
    Topic Study Note Illustration
    03

    Transactional processing

    Transaction Processing refers to managing multiple operations on a database as a single, logical unit of work , called a transaction . The goal is to ensure...

    ๐Ÿ”„ Transaction Processing in DBMS


    ๐Ÿ”ฐ What is Transaction Processing?

    Transaction Processing refers to managing multiple operations on a database as a single, logical unit of work, called a transaction. The goal is to ensure data consistency, integrity, and reliability even in cases of failures (system crash, power loss, etc.).


    ๐Ÿงพ What is a Transaction?

    A transaction is a sequence of one or more SQL operations (e.g., INSERT, UPDATE, DELETE) executed as a single unit to perform a specific task.

    Example:

    BEGIN TRANSACTION
    UPDATE Accounts SET balance = balance - 500 WHERE account_id = 'A101';
    UPDATE Accounts SET balance = balance + 500 WHERE account_id = 'A102';
    COMMIT;
    

    This transaction transfers โ‚น500 from A101 to A102. It should either complete entirely or not at all.


    โœ… Properties of Transactions (ACID)

    To ensure reliable transaction processing, every transaction must follow the ACID properties:

    Property Description
    A - Atomicity All operations in a transaction are treated as one unit: either all succeed or all fail.
    C - Consistency A transaction brings the database from one valid state to another valid state.
    I - Isolation Transactions operate independently. Intermediate states are not visible to other transactions.
    D - Durability Once a transaction is committed, its changes are permanent, even if the system crashes.

    ๐Ÿ”„ States of a Transaction

    A transaction goes through several states:

    1. Active โ€“ Transaction is executing.
    2. Partially Committed โ€“ Final operation is executed.
    3. Committed โ€“ All changes are saved to the database.
    4. Failed โ€“ A problem occurs; transaction cannot proceed.
    5. Aborted โ€“ Changes are rolled back.

    Transaction States Diagram (If youโ€™d like this as a local image or in notes, let me know)


    ๐Ÿ” Concurrency Control in Transaction Processing

    When multiple transactions execute concurrently, issues can occur such as:

    ๐Ÿ” Common Problems:

    Problem Description
    Lost Update Two transactions overwrite each otherโ€™s updates.
    Dirty Read A transaction reads data from another uncommitted transaction.
    Non-repeatable Read A transaction reads the same data twice and gets different values.
    Phantom Read A query returns different results when executed again in the same transaction.

    ๐Ÿ›ก๏ธ Solutions:

    • Locking Protocols (e.g., Two-Phase Locking)
    • Timestamp Ordering
    • Optimistic Concurrency Control

    ๐Ÿ” Transaction Control Commands in SQL

    Command Description
    BEGIN TRANSACTION Starts a new transaction
    COMMIT Saves all changes made during the transaction
    ROLLBACK Undoes all changes made during the transaction
    SAVEPOINT Creates a point in the transaction to which you can roll back

    ๐Ÿ“˜ Example in SQL:

    BEGIN;
    UPDATE employees SET salary = salary + 1000 WHERE id = 101;
    SAVEPOINT before_bonus;
    UPDATE employees SET bonus = 5000 WHERE id = 101;
    ROLLBACK TO before_bonus;
    COMMIT;
    

    This will apply salary update but undo bonus update, thanks to the savepoint.


    ๐Ÿง  Importance of Transaction Processing

    • Ensures data integrity and consistency
    • Supports concurrent access by multiple users
    • Recovers from failures (using logs, backups, checkpoints)
    • Supports atomicity and rollback in case of errors

    ๐Ÿ’ฅ Failure Types Handled in Transaction Processing

    Failure Type Description
    System Crash Power failure, OS crash
    Transaction Failure Logical errors in the transaction
    Media Failure Disk crash or file corruption
    Concurrency Conflicts Data inconsistency due to parallel transactions

    ๐Ÿงฉ Transaction Processing System (TPS)

    A Transaction Processing System is a type of software system that handles and manages transactions for applications such as:

    • Banking systems
    • Reservation systems
    • E-commerce platforms
    • Inventory management

    Features of TPS:

    • High Availability
    • Atomicity
    • Consistency and Security
    • Support for concurrent users

    ๐Ÿ“ Summary

    Concept Key Points
    Transaction A logical unit of work (group of DB operations)
    ACID Ensures reliability and consistency
    Transaction States Active, Partially Committed, Committed, Failed, Aborted
    Issues Lost updates, Dirty reads, Phantom reads
    Controls Locking, Timestamp ordering, Rollback, Savepoints

    โ† Previous topic 2
    File organizations concepts
    Next topic 4 โ†’
    Concurrency control techniques

    Past Papers

    Open this section to view and download past papers

    Click on Show Past Papers to load available exam papers.

    Reading Progress
    0%
    4mremaining
    612words
    Beginnerlevel
    On This Page

    No headings found

    Study Toolkit

    Subject Portal

    Advance Database Management Systems