SQL SERVER – ACID (Atomicity, Consistency, Isolation, Durability)

SQL
71 Comments

ACID (an acronym for Atomicity, Consistency Isolation, Durability) is a concept that Database Professionals generally look for when evaluating databases and application architectures. For a reliable database all these four attributes should be achieved.

Atomicity is an all-or-none proposition.

Consistency guarantees that a transaction never leaves your database in a half-finished state.

Isolation keeps transactions separated from each other until they’re finished.

Durability guarantees that the database will keep track of pending changes in such a way that the server can recover from an abnormal termination.

Above four rules are very important for any developers dealing with databases.

SQL SERVER - ACID (Atomicity, Consistency, Isolation, Durability) acid

This is one of the most popular interview question and answer. Additionally, I strongly believe that every software developer as well as database administrator should know the answer to this question. When you design any system or database, make sure you select the database which follows these properties as that will help you better develop applications for your business.

Andreas Reuter and Theo Härder created the acronym ACID in the year 1983 however Jim Gray had already defined these properties in the late 1970s. SQL Server, Oracle, MySQL, PostgreSQL are some of the databases which follows ACID properties by default.

Reference: Pinal Dave (https://blog.sqlauthority.com)

ACID, Database, DBA, Software Development
Previous Post
SQL SERVER – FIX : Error : 3702 Cannot drop database because it is currently in use.
Next Post
SQLAuthority News – Microsoft SQL Server 2008 Community Technology Preview (November 2007) VHD

Related Posts

71 Comments. Leave new

  • Nirmal Kumar
    May 8, 2008 12:51 am

    These are amazing and simplest answers for a student to understand better that best.

    Reply
  • nice explanation

    Reply
  • ACID example is short n sweet, real-time queries ‘ll boost up the knowledge

    Reply
  • Hey

    Boss ,

    It’s fantastic it is so easy to understand …from last 2 year when the interview time if they asked me ,what as=cid rules i just playing my recorded tape ,after reading your article i grabbed how the ACID RULE is working on server.Especially consistent state..

    Thanks very much sirjee..

    Shiva v p

    Reply
  • Good :)

    Reply
  • Nice explanation. Easy to understand and remember.
    Thanks!!!

    Reply
  • please giver a real time eg of durability

    Reply
    • Qaiser Mehmood
      January 21, 2013 5:09 pm

      The tempdb database does not follow the ACID property of “Durability”.

      Whenever Microsoft SQL Server is restarted, the tempdb is recreated. Any data that was committed to the tempdb is lost and replaced by a fresh copy from the model database, therefore violating the durability property which states that the effect of a transactoin must be persisted within the database irrespective of the state of the system.

      Reply
  • ACID

    *Atomicity states that database modifications must follow an “all or nothing” rule. Each transaction is said to be “atomic.” If one part of the transaction fails, the entire transaction fails. It is critical that the database management system maintain the atomic nature of transactions in spite of any DBMS, operating system or hardware failure.
    * Consistency states that only valid data will be written to the database. If, for some reason, a transaction is executed that violates the database’s consistency rules, the entire transaction will be rolled back and the database will be restored to a state consistent with those rules. On the other hand, if a transaction successfully executes, it will take the database from one state that is consistent with the rules to another state that is also consistent with the rules.
    * Isolation requires that multiple transactions occurring at the same time not impact each other’s execution. For example, if Joe issues a transaction against a database at the same time that Mary issues a different transaction, both transactions should operate on the database in an isolated manner. The database should either perform Joe’s entire transaction before executing Mary’s or vice-versa. This prevents Joe’s transaction from reading intermediate data produced as a side effect of part of Mary’s transaction that will not eventually be committed to the database. Note that the isolation property does not ensure which transaction will execute first, merely that they will not interfere with each other.
    * Durability ensures that any transaction committed to the database will not be lost. Durability is ensured through the use of database backups and transaction logs that facilitate the restoration of committed transactions in spite of any subsequent software or hardware failures.

    Reply
  • Atomicity: the state that either all the data modifications are performed or non is performed.

    Reply
  • good

    Reply
  • Good Explanation about ACID Properties, Thanks for useful info.

    Reply
  • kaashivinfotech
    March 30, 2011 1:10 am

    Short and sweet article Pinal

    Reply
  • Ajander singh
    March 31, 2011 2:57 pm

    Good explanation in simple words. thanks

    Reply
  • Good explanation with easy understanding……..Appreciated.

    Reply
  • Too the Point ……. Solid description ……
    i think, This is useful for every developers ……….

    Reply
  • good explanation abt acid

    Reply
  • thank very much pinal and SJMohideen for their excellence explanation for ACID properties…

    Regards
    sreenivas

    Reply
  • Alexandre Pinto
    February 9, 2012 11:29 pm

    I marvel at how poor Pinal’s posts usually are, and even more at how many people praise them. Pinal basically hasn’t explained anything, has merely stated definitions without clarifying what they mean. How can this be good?

    For example, for those who claim they had never understood ACID and now they do, please tell me whay you understand from ‘is an all-or-nothing proposition’.

    Or for example, what can you tell me about consistency, is it checked or imposed by the Database?

    I’ve began checking database sites this semester because I need a refreshment before I teach these matters again, but I’ve quickly learned to avoid SQL Authority because it’s always so short, so inflexible so terse that the only way to learn is through the comments of other people. Seriously, there are far better sites to learn about databases and SQL than here. Don’t waste your time.

    Reply
  • In fact I did not understand the difference between atomicity and consistency. If atomicity is fullfilled how could consistecy (from your definition) fail?

    Reply
  • I am not getting this. Can anyone explain this briefly…

    Reply

Leave a Reply