If we are updating a field in SQL and ALTER the row also. After giving the COMMIT command, the system is crashed.

What will happen to the commands given, whether it will UPDATE and ALTER the table or not?


For an ACID transaction, it will either commit or it will not.

The transaction will normally be written to a transaction log. It will then be written to persistent storage, and the log entry erased. If the system crashes in this process, the database server will (upon next startup) check the log for pending transactions. For each transaction it will either remove the log entry, reattempt the transaction, or roll back a partially completed transaction as appropriate depending on whether there is evidence the transaction completed or not.

This is a simplified explanation of ACID, I recommend brushing up on this Wikipedia article.

  • I would have added "If the transaction is neither complete nor naught, the DBMS is simply not ACID compliant", otherwise +1.
    – phresnel
    Mar 5 '14 at 7:42
  • 1
    That is why I prefaced the entire answer with "For an ACID transaction..." the assumption here is the database is ACID-compliant, which most are in 2014 minus some embedded DBs designed for specialized purposes. When most people think "SQL" they think Oracle, MySQL, SQL Server, PostgreSQL, etc. which are all ACID-compliant.
    – user22815
    Mar 5 '14 at 14:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.