Skip to main content

ACID PROPERTICES in DATABASE MANAGEMENT SYSTEMS

 

What is ACID?

ACID is an acronym that stands for Atomicity, Consistency, Isolation, and Durability. These properties ensure reliable processing of database transactions.

The ACID Properties 

1. Atomicity

  • Definition: All operations in a transaction succeed or they all fail.
  • Key Point: It's all or nothing.
  • Example: Transferring $100 from Account A to Account B:
    • Deduct $100 from Account A
    • Add $100 to Account B
    If either step fails, the entire transaction is rolled back.

2. Consistency

  • Definition: The database remains in a consistent state before and after the transaction.
  • Key Point: All rules and constraints are enforced.
  • Example: Rule: Account balance cannot be negative
    • Initial balance of Account A: $50
    • Attempt to withdraw $100 from Account A
    • Transaction will fail to maintain consistency

3. Isolation

  • Definition: Multiple transactions can occur concurrently without interfering with each other.
  • Key Point: Transactions appear to be executed sequentially.
  • Example: Two simultaneous withdrawals from Account A with $1000 balance:
    • Transaction 1: Withdraw $200
    • Transaction 2: Withdraw $500
    Result: Final balance will be $300, as if one transaction completed before the other started.

4. Durability

  • Definition: Once a transaction is committed, it stays committed.
  • Key Point: Changes survive system failures.
  • Example:
    • Update customer address in database
    • System confirms update is complete
    • If the system crashes immediately after, the new address is still there when it restarts

Why ACID Matters

  1. Ensures data accuracy and reliability
  2. Protects against errors and system failures
  3. Simplifies application development

ACID in Different Databases

  • Relational Databases (e.g., MySQL): Fully ACID compliant
  • Some NoSQL Databases (e.g., MongoDB): Offer varying levels of ACID compliance

Real-World Analogy

Think of ACID like a safe deposit box in a bank:

  • Atomicity: You either put all your valuables in or take them all out.
  • Consistency: The box always follows bank rules (e.g., weight limit).
  • Isolation: Other people accessing their boxes don't interfere with your access.
  • Durability: Once you close the box, your items stay there even if the power goes out.

Alternatives to ACID

For systems where absolute consistency isn't critical, alternative models like BASE (Basically Available, Soft state, Eventual consistency) are sometimes used, especially in distributed systems.

Conclusion

ACID properties are fundamental to ensuring data integrity and reliability in database systems. While they may introduce some overhead, they are crucial for applications where data accuracy and consistency are paramount, such as financial systems or healthcare databases. Understanding ACID helps in choosing the right database system and designing robust database applications.


Comments

Popular posts from this blog

ORACLE Express Edition: Getting Started

1. Introduction to Oracle Database 21c Express Edition (XE) - Free, lightweight version of Oracle Database - Ideal for learning and small-scale applications - Limited to 12GB of user data and uses up to 2GB of RAM 2. Installation and Setup 2.1 Installing Oracle 21c XE 1. Download Oracle 21c XE from: https://www.oracle.com/database/technologies/xe-downloads.html 2. Run the installer:    - Windows: Double-click the .exe file    - Linux: Use `rpm` or `yum` command 3. Follow the installation wizard:  Accept the license agreement Choose an installation location (default is usually fine) Set a password for the SYS, SYSTEM, and PDBADMIN accounts (write this down!) Select the option to start the database service automatically (recommended)  4. Complete the installation: Wait for the installation process to finish Note down the database connection details provided at the end The default container database (CDB) name is XE The default pluggable database (PDB) nam...

MYSQL Constraints

 PK - Primary Key: Uniquely identifies each record in a table. NN - Not Null: Ensures a column cannot have a NULL value. UQ - Unique: Ensures all values in a column are different. B - Binary: Stores binary byte strings. UN - Unsigned: For numeric types, allows only non-negative values. ZF - Zero Fill: Pads numeric values with zeros to the left. AI - Auto Increment: Automatically generates a unique number for new records. G - Generated Column: Value is computed from an expression. PK - Primary Key A primary key uniquely identifies each record in a table. It must contain unique values and cannot have NULL values.  Example: CREATE TABLE Students ( StudentID INT PRIMARY KEY , Name VARCHAR ( 50 ) , Age INT ) ; Here, StudentID is the primary key. NN - Not Null  This constraint ensures that a column cannot have NULL values.  Example: CREATE TABLE Employees ( EmployeeID INT PRIMARY KEY , Name VARCHAR ( 50 ) NOT NULL , Email VA...

Practical 1: Getting Started with MYSQL

 Getting Started with MySQL Introduction to MySQL Definition: MySQL is an open-source relational database management system (RDBMS) Uses: Web applications, data warehousing, e-commerce, logging applications Key features: Speed, reliability, scalability, and ease of use Installing MySQL Download MySQL Community Server from official website Follow installation wizard for your operating system Set root password during installation Verify installation: mysql --version MySQL Command-line Client Accessing MySQL: mysql -u root -p Basic commands: SHOW DATABASES ; CREATE DATABASE mydb ; USE mydb ; SHOW TABLES ; MySQL Workbench Introduction: Visual tool for database design and management Key features: SQL development Data modeling Server administration Example: Creating a new connection New Connection > Enter details (hostname, username, password) PHPMyAdmin Web-based MySQL administration tool Often comes pre-installed with web hosting packag...