Skip to main content
added 253 characters in body
Source Link
gnasher729
  • 49.4k
  • 4
  • 71
  • 137

Even software running just on your home laptop should/will use transactions. For example, your software decides that one value in the database is increased, and another is decreased by the some amount, and then the whole operation is removed from a task list in the database.

You make that a transaction so if the software crashes you will have either no change or all three changes in the database. Not just the first change or the first two changes. So if you restart the app after the crash, either the whole operation has been performed and is gone from the task list, or the operation is still in the task list and you can repeat it.

Without transactions you might find yourself in a situation where the increase has happened but not the decrease, or both have happened but the operation is still in the task list and you do it twice. Lots of opportunities to mess up your database.

Even software running just on your home laptop should/will use transactions. For example, your software decides that one value in the database is increased, and another is decreased by the some amount, and then the whole operation is removed from a task list in the database.

You make that a transaction so if the software crashes you will have either no change or all three changes in the database. Not just the first change or the first two changes. So if you restart the app after the crash, either the whole operation has been performed and is gone from the task list, or the operation is still in the task list and you can repeat it.

Even software running just on your home laptop should/will use transactions. For example, your software decides that one value in the database is increased, and another is decreased by the some amount, and then the whole operation is removed from a task list in the database.

You make that a transaction so if the software crashes you will have either no change or all three changes in the database. Not just the first change or the first two changes. So if you restart the app after the crash, either the whole operation has been performed and is gone from the task list, or the operation is still in the task list and you can repeat it.

Without transactions you might find yourself in a situation where the increase has happened but not the decrease, or both have happened but the operation is still in the task list and you do it twice. Lots of opportunities to mess up your database.

Source Link
gnasher729
  • 49.4k
  • 4
  • 71
  • 137

Even software running just on your home laptop should/will use transactions. For example, your software decides that one value in the database is increased, and another is decreased by the some amount, and then the whole operation is removed from a task list in the database.

You make that a transaction so if the software crashes you will have either no change or all three changes in the database. Not just the first change or the first two changes. So if you restart the app after the crash, either the whole operation has been performed and is gone from the task list, or the operation is still in the task list and you can repeat it.