DEV Community

Cover image for Transactions
Pragya Sapkota
Pragya Sapkota

Posted on • Originally published at pragyasapkota.Medium

Transactions

Transactions are a series of database operations. Each transaction is a single unit of the main task. The data integrity is intact in these transactions since all the operations either fail together or succeed together.

Generally, some databases choose to leave out ACID transactions because of the other required optimizations and theoretically impossible implementations. As we have already discussed before, ACID transactions are supported by a relational database while BASE transactions are supported by a non-relational. However, there are exceptions where the relational database doesn’t support ACID transactions but some of the non-relational ones do.

States on the transactions

Transaction States

Any transaction that happens in the database can be in either of the following states: -

  1. Active — Initial State of every transaction where they are being executed.

  2. Partially Committed — When a transaction executes its very last operation.

  3. Committed — When a transaction finishes all the operations successfully. The effects establish themselves in the database system afterward.

  4. Failed — When the checks on the database recovery system fail and cannot go further.

  5. Aborted — When the transaction reaches the failed state, the recovery manager stops all the write operations which bring the database to the original position before the execution started. The henceforth state is now called aborted and moving forward, the transactions can either restart or kill themselves.

  6. Terminated — When there are no abortions and the transactions come through successfully, the database system becomes consistent, and the transaction is terminated while the new one will soon start.

I hope this article was helpful to you.

Please don’t forget to follow me!!!

Any kind of feedback or comment is welcome!!!

Thank you for your time and support!!!!

Keep Reading!! Keep Learning!!!

Top comments (0)