tailieunhanh - Joe Celko s SQL for Smarties - Advanced SQL Programming P76

Joe Celko s SQL for Smarties - Advanced SQL Programming P76. In the SQL database community, Joe Celko is a well-known columnist and purveyor of valuable insights. In Joe Celko's SQL for Smarties: Advanced SQL Programming, he picks up where basic SQL training and experience leaves many database professionals and offers tips, techniques, and explanations that help readers extend their capabilities to top-tier SQL programming. Although Celko denies that the book is about database theory, he nevertheless alludes to theory often to buttress his practical points. This title is not for novices, as the author points out. Instead, its intended. | 722 CHAPTER 32 TRANSACTIONS AND CONCURRENCY CONTROL Isolation actually becomes more complicated in practice because one transaction may or may not actually see the data inserted updated or deleted by another transaction. This will be dealt with in detail in the section on isolation levels. Durability The database is stored on durable media so that if the database program is destroyed the database itself persists. Furthermore the database can be restored to a consistent state when the database system is restored. Log files and backup procedures figure into this property as well as disk writes done during processing. This is all well and good if you have just one user accessing the database at a time. But one of the reasons you have a database system is that you also have multiple users who want to access it at the same time in their own sessions. This leads us to concurrency control. Concurrency Control Concurrency control is the part of transaction handling that deals with the way multiple users access the shared database without running into each other like a traffic light system. One way to avoid any problems is to allow only one user in the database at a time. The only problem with that solution is that the other users are going to get lousy response time. Can you seriously imagine doing that with a bank teller machine system or an airline reservation system where tens of thousands of users are waiting to get into the system at the same time The Five Phenomena If all you do is execute queries against the database then the ACID properties hold. The trouble occurs when two or more transactions want to change the database at the same time. In the SQL model there are five ways that one transaction can affect another P0 Dirty Write Transaction T1 modifies a data item. Another transaction T2 then further modifies that data item before T1 performs a COMMIT or ROLLBACK. If T1 or T2 then performs a rollback it is unclear what the correct data value .