ACID properties_DBMS.pdf

AbhoyBiswas1 163 views 13 slides Feb 07, 2024
Slide 1
Slide 1 of 13
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13

About This Presentation

This is a template ready ppt for Makaut 6sem CSE/IT CA1 ppt . Just download and rename the file


Slide Content

Department of
Information
Technology
ACID
PROPERTIES
A advantage in managing Database entities
Kalyani Government Engineering College
submitted by : Abhoy Biswas
Roll : 10200321037 , Year: 3rd [Sem: 5th]
Sub Code : PCC-CS601
Sub : DBMS

Atomicity
Condistency
Isolation
Durability
A brief Presentation
Introduction
to ACID

ATOMICITY CONSISTENCY ISOLATION
This property ensures
that a transaction is
treated as a single,
indivisible unit of work.
Either all the changes
made during the
transaction are
committed to the
database, or none of
them are.

It ensures that a transaction
brings the database from one
valid state to another. In other
words, the database must satisfy
a set of integrity constraints
before and after the transaction.It
ensures that a transaction brings
the database from one valid
state to another. In other words,
the database must satisfy a set
of integrity constraints before and
after the transaction.
This property ensures
that the execution of one
transaction is isolated
from the execution of
other transactions. Even
if multiple transactions
are executed
concurrently, the result
should be the same as if
they were executed
sequentially.
ACID is an acronym that stands for Atomicity, Consistency, Isolation, and Durability.
Defination of ACID
DURABILITY
Durability guarantees that
once a transaction is
committed, its effects are
permanent and survive
system failures. Even if the
system crashes, the
committed changes to the
database should not be lost.

Importance of ACID
properties in ensuring
reliable database
transactions.
The ACID properties of database transactions are crucial for ensuring
reliability and integrity. Atomicity guarantees complete transaction
completion or complete rollback, consistency maintains a valid
database state and isolation prevents interference between
concurrent transactions. Durability ensures the persistence of
transaction effects in the event of system failures. Together, these
properties offer a robust framework for data consistency and
durability, ensuring confidence in the reliability of stored information.

In Java, achieving atomic transactions involves encapsulating a series of
related operations within a single unit of work that either fully completes or is
entirely rolled back in case of an error. Consider a scenario where a money
transfer transaction is initiated by user input. In this case, it's crucial to ensure
atomicity to prevent inconsistencies such as deducting funds from one
account without successfully crediting them to another. Let's look at a code
snippet that demonstrates atomic transactions in Java for a money transfer
scenario:
In this code snippet, the transaction begins with `connection.setAutoCommit(false)`
to disable automatic committing. The user is prompted for details, and the actual
operations (deducting and crediting funds) are performed within the transaction. If
any exception occurs during these operations, the transaction is rolled back,
ensuring that the database remains in a consistent state. If everything is successful,
the transaction is committed, finalizing the atomic unit of work.
Java code (involving Atomicity)
A cenario of Money transfer transaction

Java code (involving
consistency )
Java code that demonstrates a simple consistency check before
updating a user's profile in a database:
This code snippet includes a simple consistency check in
the isProfileUpdateValid method, ensuring that the
username is not empty and the email contains the "@"
symbol. The profile update is performed only if the
consistency check passes, maintaining the integrity of the
user data in the database.

Java code (involving isolation )
Implementing isolation in concurrent transactions involves using locks to avoid
conflicts and ensure that the execution of transactions produces the same result as
if they were executed serially.
This is typically done to prevent issues like dirty reads and inconsistent data states. Below
is a simple code snippet demonstrating isolation through the use of locks:
The isSufficientBalance method checks if there is enough balance in the
account before proceeding with the deduction.

Durability
Durability is one of the ACID properties ensuring
that committed changes to the database remain
permanent even during system failures.
Transaction logs play a crucial role in ensuring
durability by recording every operation or change
made to the database during a transaction.
System-level mechanisms like write-ahead
logging (WAL) and periodic database backups,
replication, and redundant storage systems also
reinforce durability, ensuring data remains secure
and consistent over the long term, thus
reinforcing the reliability of the database system.

CONSISTENCY IN A DISTRIBUTED
ENVIRONMENT:
Achieving strong consistency across nodes in a distributed
system can be challenging, as the communication delays
and potential network partitions may lead to difficulties in
synchronizing the state of all nodes.
ISOLATION ACROSS NODES:
Ensuring isolation between concurrently executing
transactions across distributed nodes requires
sophisticated techniques to prevent conflicts and maintain
the illusion of transactional independence.
DURABILITY IN THE FACE OF NETWORK
FAILURES:
Guaranteeing durability becomes challenging when
considering data storage across multiple nodes, as network
failures or node crashes may result in data inconsistencies.
A drawback of ACID
Challenges in
Maintaining
ACID Properties
in Distributed
Databases:

Database Atomicity Consistency Isolation Durability
PostgreSQL Yes Yes Yes Yes
MySQL Yes Yes Yes Yes
Oracle Database Yes Yes Yes Yes
MongoDB Yes Some Some Yes
Cassandra Yes Some Some Yes

Replication and Sharding Use data replication for fault tolerance and sharding to distribute
the load, ensuring a balance between consistency and performance.
Consistency Levels Adjust the consistency levels based on application requirements,
choosing between strong consistency or eventual consistency for improved performance.
Caching Strategies Implement caching mechanisms to reduce the need for frequent
database access, optimizing read performance while considering potential data
staleness.
Transaction Batching Group multiple operations into a single transaction batch to
minimize the overhead of individual transactions, improving throughput.
Considerations for Balancing
ACID Properties with
Performance:

A brief recap of ACID property
Concluding Thoughts
ACID properties (Atomicity, Consistency, Isolation, and Durability) ensure the
reliability and integrity of database transactions. Transactions are indivisible
units, adhering to predefined constraints, preventing interference between
concurrent transactions, and persisting even in system failures. Adherence
to ACID principles is crucial in applications where data accuracy and
integrity are critical, such as in financial systems, healthcare, and mission-
critical domains.

References
Google - Wikipedia {Article on ACID
,DBMS}
GFG - ACID properties in DBMS