What are ACID properties, really?

If you’re studying (or working on) SQL there are high chances you’ve come across this term before. In fact, you should have, as it’s really important to be aware of these properties.

ACID is an acronym for 4 properties that are interconnected on some level. These are:

  • Atomicity
  • Consistency
  • Isolation
  • Durability

    What I’m going to do is, I’ll try to explain all 4 of them in as simple words as possible – with examples and without excessive use of technical mumbo jumbo.

    1. Atomicity:
      This property deals with the completeness of any SQL query (or transaction). It says that if a query is in the middle of execution, and suppose the system crashes or for some reason the process is interrupted, the database should be in a state of 0 or 1. That is – either the query should be executed completely or nothing at all. There cannot be any partial state or half execution.
    2. Consistency:
      SQL databases are mostly implemented when the requirements are large and multiple users are going to be accessing it simultaneously. Imagine a situation when the data isn’t consistent for all users? Suppose the airline company is conducting a huge sale offering flights at flat 90% off. However due to inconsistency your friend can avail of this special discount but you can’t even see it yet. Tragedy isn’t it? The second ACID property deals with preventing such situations, there by giving all users consistent data all the time.
    3. Isolation:
      Probably one of the most important properties of any SQL database. It says that if two users are reading or writing into a database, their operations must be completely isolated from each other. Imagine 2 individuals, completely unrelated are accessing their bank details, and due to lack of isolation, a transfer of a huge amount by one individual is recorded in the account of the second individual. I’m sure nobody would want such a thing to happen. Or, what if 2 people book the same seats for a movie? Even if you try, one of the two persons will definitely get a message saying the seat has been booked. That’s because it’s very important that while running a parallel system at least some amount of isolation is maintained.
    4. Durability:
      Last but not the least, all systems should be safe and durable. If the system crashes for any reasons or there has been an unexpected breach in security, an option of rolling back to a safe and consistent state should always be present.

      Hopefully this will help clear the concepts. It’s always important to understand than to mug up textbook words. 


      Leave a Reply

      Fill in your details below or click an icon to log in:

      WordPress.com Logo

      You are commenting using your WordPress.com account. Log Out /  Change )

      Google+ photo

      You are commenting using your Google+ account. Log Out /  Change )

      Twitter picture

      You are commenting using your Twitter account. Log Out /  Change )

      Facebook photo

      You are commenting using your Facebook account. Log Out /  Change )


      Connecting to %s

      Create a free website or blog at WordPress.com.

      Up ↑

      %d bloggers like this: