Encyclopedia > Timestamp-based concurrency control

  Article Content

Timestamp-based concurrency control

In computer science, in the field of databases, timestamp-based concurrency control is a non-lock concurrency control method, used in relational databases to safely handle transactions, using timestamps.

Each transaction can be assigned a timestamp at startup, so we can ensure that if an action Ai of a transaction Ti conflicts with action Aj of a transaction Tj, action Ai occurs before action Aj if TS(transaction Ti) < TS(transaction Aj). If an action violates the order, the transaction is aborted and restarted.

Every database object O is given a read timestamp RTS(O) and a write timestamp WTS(O).

If a transaction T wants to read O, and TS(T) < WTS(O), the order of the read with respect to the most recent write on O would violate the timestamp order between transaction and writer. So, T is aborted and restarted with a new, larger timestamp. If a transaction T wants to read O, and TS(T) > WTS(O), T reads O, RTS(O) is set to max[RTS(O), TS(T)].

If a transaction T wants to write O, if TS(T) < RTS(O), the write action would conflict with the read action of O and T is aborted and restarted.

If a transaction T wants to write O, if TS(T) < WTS(O), we use the Thomas Write Rule and ignore this write to O and continue.

Otherwise, T writes to O, and WTS(O) is set to TS(T).



All Wikipedia text is available under the terms of the GNU Free Documentation License

 
  Search Encyclopedia

Search over one million articles, find something about almost anything!
 
 
  
  Featured Article
Quadratic formula

... fraction; the common denominator is 4a2. We get <math>\left(x+\frac{b}{2a}\right)^2=\frac{-4ac+b^2}{4a^2}=\frac{b^2-4ac}{4a^2}.</math> Taking square roots ...

 
 
 
This page was created in 23.7 ms