response database
(Naylene)When multiple transactions run concurrently, there becomes a high risk of inconsistency, such as data changing mid-use, updated data getting lost, rollbacks from errors, and more (Coronel & Morris, 2019). Anytime one or more transactions are attempting to write data at the same time, errors will occur.
This is where the scheduler is beneficial. What is a scheduler? The textbook states it "interleaves the execution of database operations in a specific sequence to ensure serializability" (Coronel & Morris, 2019). This ensures the transactions are being executed sequentially to ensure the data is accurate when accessed (Coronel & Morris, 2019). This is vital for serializability.
The great thing is that it does not apply to every transaction. For transactions that are done one by one or transactions that don't interact, the scheduler doesn't have to order them. In those circumstances, it just does first come, first serve (Coronel & Morris, 2019). When it's needed, that's when it applies serialization, so the data behaves as if the transactions were done in a serial order (Coronel & Morris, 2019). This is beneficial in ensuring the CPU and storage systems are managed efficiently (Coronel & Morris, 2019).
One of the most common methods of this is the locking method. When one user access it, it locks the data giving a single user permission to access it and only unlocks once the transaction is completed (Coronel & Morris, 2019). It's actually what the patient management tool at my job does. Whenever someone opens a demographic chart to edit, the data locks onto them. If any other user attempts to access it at that time, they'll receive an error that someone else is using it and will try again later.
Meanwhile, my previous company utilized an optimistic approach. Essentially it allows anyone or as many people to access the data at the time and make any changes they wanted all the way up to the validation stage (Coronel & Morris, 2019). At that time, it will report any errors or conflicts. The validation page will write the new data if it clears without error. If any error occurred, you were required to go back and fix the mistake or discard all changes entirely.
Reference
Coronel, C., & Morris, S. (2019). Database systems: Design, implementation, and management (13th e). Cengage Learning.