To address the other possible
problems, one simply specifies the level of isolation required, using one of four levels standardized by the 1992
SQL standard. The reason the standard provides different levels of protection is that greater protection usually
comes at the cost of reduced performance (less concurrency, and therefore fewer transactions per unit time).
CHAP. 8] DATABASE 161
The four transaction isolation levels are, in order from weakest to strongest, read uncommitted, read
committed, repeatable read, and serializable. Read uncommitted provides no protection against the concurrency
issues we have been discussing, but it does provide maximum performance.
Read committed insures against dirty reads by never allowing a transaction to read data that have not
been committed to the database. Repeatable read also insures against the problem of nonrepeatable reads.
Serializable provides complete separation of concurrent transactions by locking all the rows necessary during
the entire transaction. Such safety comes at the cost of a significant impact on performance for multiuser
applications.
Usually the default transaction isolation level is read committed.
ACCESSING THE DATABASE PROGRAMMATICALLY
Creating a database and accessing it interactively using SQL can be pretty marvelous in itself, but in almost
all cases production databases are accessed and updated via programs.
Pages:
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444