Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 7

TUDTUD RIANNE CELONE P.

BSCpE-2B
1. Introduction to ACID Properties:
 Briefly introduce the concept of ACID properties in DBMS.
 ACID properties are fundamental concepts in database management
systems (DBMS) that ensure reliability, consistency, and integrity of data.
 Explain the four properties: Atomicity, Consistency, Isolation, and Durability.
 ACID is an acronym for Atomicity, Consistency, Isolation, and Durability.

2. Setup:
 Ensure that MySQL database server is installed and running.

 Connect to the MySQL server using the client software.

3. Atomicity:
 Explain atomicity as the property that ensures that either all operations within a
transaction are completed successfully or none of them are.
 Atomicity ensures that either all operations within a transaction are
completed successfully, or none of them are. This property guarantees
that transactions are indivisible and maintain data integrity.
 Demonstrate atomicity using a simple transaction with multiple SQL statements.
 START TRANSACTION;
INSERT INTO table_name (column1, column2) VALUES (value1, value2);
UPDATE table_name SET column1 = new_value WHERE condition;
DELETE FROM table_name WHERE condition;
COMMIT;
 Show how a failure in any part of the transaction rolls back all changes made by
the transaction.
4. Consistency:
 Discuss consistency as the property that ensures that the database remains in a
consistent state before and after the transaction.
 Consistency ensures that the database remains in a consistent state
before and after the transaction. It prevents the database from being left in
an incomplete or invalid state.
 Create a scenario where consistency is violated (e.g., violating a foreign key
constraint).
 INSERT INTO orders (order_id, customer_id) VALUES (1, 1000);
START TRANSACTION;
INSERT INTO customers (customer_id, name) VALUES (1000, 'John
Doe');
INSERT INTO orders (order_id, customer_id) VALUES (1, 1000);
COMMIT;
 Execute a transaction that maintains consistency and demonstrate how the
database remains in a consistent state.
5. Isolation:
 Explain isolation as the property that ensures that the execution of transactions
concurrently yields the same results as if they were executed serially.
 Isolation ensures that the execution of transactions concurrently yields the
same results as if they were executed serially. Different isolation levels in
MySQL, such as READ COMMITTED and REPEATABLE READ, control
the level of isolation and concurrency.
 Create multiple sessions or connections to the MySQL server.
 START TRANSACTION;
SELECT * FROM table_name WHERE condition FOR UPDATE;

START TRANSACTION;
UPDATE table_name SET column1 = new_value WHERE condition;
COMMIT;
 Execute transactions concurrently that access the same data and demonstrate
isolation levels.
 Discuss different isolation levels supported by MySQL (e.g., READ
COMMITTED, REPEATABLE READ).
 READ UNCOMMITTED:
 This is the lowest isolation level where transactions can read
uncommitted changes made by other transactions.
 Transactions at this level are susceptible to dirty reads, meaning
they can read data that has been modified but not yet committed by
another transaction.
 MySQL allows this level but doesn't enforce strict isolation.
 READ COMMITTED:
 In this isolation level, transactions can only read data that has been
committed by other transactions.
 This level prevents dirty reads but still allows non-repeatable reads
and phantom reads (i.e., reading new rows inserted by other
transactions).
 This is the default isolation level for MySQL.
 REPEATABLE READ:
 In this isolation level, a transaction sees a consistent snapshot of
the database at the beginning of the transaction.
 This prevents non-repeatable reads, meaning if a transaction reads
a row once, it will get the same data if it reads the row again within
the same transaction.
 However, phantom reads are still possible, as new rows can be
inserted by other transactions.
 This is the default isolation level for InnoDB storage engine in
MySQL.
 SERIALIZABLE:
 This is the highest isolation level where transactions are completely
isolated from each other.
 It prevents dirty reads, non-repeatable reads, and phantom reads
by placing strict locks on all data read by a transaction until the
transaction is committed or rolled back.
 This level ensures that concurrent transactions do not interfere with
each other but can lead to increased contention and reduced
concurrency
6. Durability:
 Describe durability as the property that ensures that once a transaction is
committed, its changes are permanent even in the event of a system failure.
 Durability guarantees that once a transaction is committed, its changes
are permanent, even in the event of a system failure. This property
ensures that committed data remains intact and recoverable.
 Execute a transaction that makes changes to the database and commits the

changes.

 Simulate a system failure (e.g., by restarting the MySQL server or terminating the
connection).

 Reconnect to the MySQL server and verify that the changes made by the
committed transaction are still present.
7. Conclusion:
 Summarize the key points learned about ACID properties in DBMS.
 ACID properties ensure data safety: They act like the guardians of your
data, making sure it doesn't get lost or corrupted.
 Atomicity keeps transactions all or nothing: It's like a "do or don't do" rule
for database changes, preventing half-done actions.
 Consistency is the data's sense of order: Imagine it as the conductor
making sure all instruments play in harmony.
 Isolation avoids transaction traffic jams: It's like giving each car on the
road its own lane to prevent accidents.
 Durability is like data's superglue: Once committed, changes stick around
even if the system takes a tumble.
 Discuss the importance of ACID properties in ensuring data integrity, reliability,
and consistency.
 ACID properties are essential for maintaining data integrity, reliability, and
consistency in DBMS. Understanding and implementing these properties
correctly are crucial for developing robust and dependable database
systems.
 Encourage further exploration and experimentation with ACID properties in
MySQL.
 Experimenting with different scenarios and isolation levels in MySQL can
provide valuable insights into how ACID properties function and their
impact on transaction management.

You might also like