MIS 325 Lecture 26: MIS 325 – Intro to Concurrency– 3.3
MIS 325 – Intro to Concurrency– 3.3
• Common exceptions
o Duplicate value in index
o No data found
o Dividing by zero
o Invalid number
o Value error
• Terminology
o Transaction: group of SQL statements that are combined into a single lock
o Save point: creating a point in which you save mid script
▪ Useful if you have a lot of data
o Concurrency: When two or more users have access to the same
database, it is possible for them to work with the same data at the same
time
o Deadlock: two transactions that cannot be committed because each has a
lock on a resource needed by the other transaction
• Concurrency
o Does not happen when ppl are just searching databases
o Concurrency becomes a problem when one user updates the data that
other users are also viewing or updating
o i.e. Registering for classes:
▪ multiple ppl at same time trying to find courses
▪ all are simultaneously updating the database – concurrency is very
useful in this situation
o if you make changes in database, they will be observable even if you don’t
commit
▪ after you commit, the change will become permanent
o four types of concurrency problems
▪ lost updates
▪ dirty reads
▪ non-repeatable reads
▪ phantom reads
o Concurrency problems prevented by each transaction isolated level
▪ Isolation level: extended to which a transaction is isolated from
another
Isolation level
Dirty
reads
Lost
updates
Nonreadable
reads
Phantom
reads
Read
uncommitted
Allows
Allows
Allows
Allows
Read
committed
Prevents
Allows
Allows
Allows
Repeatable
read
Prevents
Prevents
Prevents
Allows
Serializable
Prevents
Prevents
Prevents
Prevents
Snapshot
Prevents
Prevents
Prevents
Prevents
find more resources at oneclass.com
find more resources at oneclass.com