What's a real-world example of ACID? [closed]
Asked Answered
I

3

35

I'm looking for a real-world example for the various ACID properties of a database.

Introvert answered 16/6, 2009 at 2:43 Comment(0)
J
56
  • Atomicity - a transaction to transfer funds from one account to another involves making a withdrawal operation from the first account and a deposit operation on the second. If the deposit operation failed, you don’t want the withdrawal operation to happen either.

  • Consistency - a database tracking a checking account may only allow unique check numbers to exist for each transaction

  • Isolation - a teller looking up a balance must be isolated from a concurrent transaction involving a withdrawal from the same account. Only when the withdrawal transaction commits successfully and the teller looks at the balance again will the new balance be reported.

  • Durability - A system crash or any other failure must not be allowed to lose the results of a transaction or the contents of the database. Durability is often achieved through separate transaction logs that can "re-create" all transactions from some picked point in time (like a backup).

(summary of the real world examples from le dorfier's link)

Jaggy answered 16/6, 2009 at 3:9 Comment(2)
That link is dead now.. Can you please update it?Schnorkle
@VedantTerkar try this link [link] web.archive.org/web/20110823114953/http://www.archwing.com/…Micrometry
D
13

• Atomicity—From a user perspective, a transaction is either completed in its entirety (i.e., all relevant database tables are updated) or not at all. If an error or interruption occurs, all changes made up to that point are backed out.

• Consistency—All integrity conditions in the database are maintained with each transaction, taking the database from one consistent state into another consistent state.

• Isolation—Each transaction is isolated from other transactions, and hence, each transaction only accesses data that are part of a consistent database state.

• Durability—If a transaction has been reported back to a user as complete, the resulting changes to the database survive subsequent hardware or software failures.

Delubrum answered 18/12, 2015 at 1:47 Comment(0)
C
3

Take any given perl script you use to manipulate a data in a relational database, put a "BEGIN" at the top of it and a "COMMIT" at the bottom, and you know the perl script worked, or didn't have effect your database at all (unless you inserted DDL statements on mysql). Atomicity is very powerful to have an assurance like that when designing robust software (and my favorite of the properties).

Commonalty answered 16/6, 2009 at 2:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.